You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing around with it and noticed some odd behaviour. Calling setBit(n, true) will set bit n counting from the least significant bit upwards (as expected), but getBit(n) will look in a different place.
It looks like the logic of getBithas been tuned quite specifically for the file permission case, while also counting bits in the reverse order, and the position of the "0" bit depends on which base was used when initializing the mask, which in the case of file permissions (base 8 with 3 digits) happens to work:
Hi, thanks for the library!
I was playing around with it and noticed some odd behaviour. Calling
setBit(n, true)
will set bitn
counting from the least significant bit upwards (as expected), butgetBit(n)
will look in a different place.It looks like the logic of
getBit
has been tuned quite specifically for the file permission case, while also counting bits in the reverse order, and the position of the "0" bit depends on which base was used when initializing the mask, which in the case of file permissions (base 8 with 3 digits) happens to work:bit-mask/bit-mask.js
Lines 18 to 20 in ee387f1
This should probably be changed to mirror how
setBit
works, with bit0
being the rightmost, least significant bit.The text was updated successfully, but these errors were encountered: