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
There are a few places in the code base that use integer division and modular arithmetic. It may be possible to replace them with faster bit-shifting equivalents. Imagine a variable mPosition that points to a particular bit within a byte array. Retrieving the value of the bit can be accomplished as follows, where BYTE_INDEX_SHIFT equals 3 (i.e., log base 2 of 8):
Re:
https://github.com/jinahya/bit-io/blob/develop/src/main/java/com/github/jinahya/bit/io/AbstractBitInput.java#L116
There are a few places in the code base that use integer division and modular arithmetic. It may be possible to replace them with faster bit-shifting equivalents. Imagine a variable
mPosition
that points to a particular bit within a byte array. Retrieving the value of the bit can be accomplished as follows, whereBYTE_INDEX_SHIFT
equals3
(i.e., log base 2 of 8):I suspect such calculations will be more efficient than using
%
, especially on older hardware.The text was updated successfully, but these errors were encountered: