bit() too slow and strange pong behavior.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

bit() too slow and strange pong behavior.

HighSchoolerWhoAsksHowTooMuch
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: bit() too slow and strange pong behavior.

ashort
This post was updated on .
been a while since I've looked at this, but my bit function is a boolean function that returns whether or not a certain bit of an integer is on.  

If you use your twoToThe array that you initialized in init(), the bit function can be written in literally one line of code.  Think about using a certain element of your twoToThe array as a bitmask.   For example, if you want to know if the 5th bit is on, use the 5th element of your array as a bitmask.  
Reply | Threaded
Open this post in threaded view
|

Re: bit() too slow and strange pong behavior.

ashort
something that will help you is to study how the numbers in your twoToThe array are represented in binary.

for example, the number 128 is 0000000010000000

and the number 1024 is 0000010000000000

and so on...
Reply | Threaded
Open this post in threaded view
|

Re: bit() too slow and strange pong behavior.

HighSchoolerWhoAsksHowTooMuch
Got it! Thank you!