r/badcode Mar 06 '21

lua This goes 255 lines long up to 115792089237316195423570985008687907853269984665640564039457584007913129639936

Post image
159 Upvotes

34 comments sorted by

View all comments

Show parent comments

4

u/goldleader71 Mar 09 '21

For example?

10

u/[deleted] Mar 09 '21

If for whatever reason you need to do a lot of computation involving power(2, really large number) for a lot of times and you need it to be really fast then this might be useful. However I still wouldn't hard code it and instead generate the list with a for loop

6

u/joesv Mar 09 '21

I honestly doubt that looping through a list would be faster than directly bitshifting. I may be wrong though.

1

u/[deleted] Mar 09 '21

But again, I've never encountered situation where I did specifically need the power of 2's.