vterron / lemon

Differential photometry for humans (and astronomers)
64 stars 21 forks source link

Use a bit mask to check the value of the third bit #95

Closed vterron closed 6 years ago

vterron commented 6 years ago

Instead of (a) representing the number as a binary string, (b) zfill()'ing it and (c) accessing the third bit, do it the right way and use a bit mask. An elegant approach for a more civilized age.

pablogsal commented 6 years ago

Also, it happens to be 100x times faster, so we can re-shell this extra nanoseconds in the black market: