Skip to main content
added 58 characters in body
Source Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly and is a well known bit operation technique. Right-to-left indexes are more common in bitwise systems.

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly and is a well known bit operation technique.

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly and is a well known bit operation technique. Right-to-left indexes are more common in bitwise systems.
obsolete part
Source Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly.
  • I'm not sure what you mean with the shift operations. Isn't >> a shift already? I just noticed this function operates on an array rather than and is a single bytewell known bit operation technique.

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly.
  • I'm not sure what you mean with the shift operations. Isn't >> a shift already? I just noticed this function operates on an array rather than a single byte.

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly and is a well known bit operation technique.
Source Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101

Review

  • The postfix AtIndex is too verbose. You don't have any other operations like AtMask or anything and the index is provided as argument. So I would prefer IsBitSet over IsBitSetAtIndex etc.
  • The index is sometimes a byte, sometimes a uint. I would not bother with such level of (over-)engineered type picks. Stick with the common type for an index int. You can always add argument checks for bounds.
  • You can replace 1 << 7 - index with 1 << index in your operations. This is written more compactly.
  • I'm not sure what you mean with the shift operations. Isn't >> a shift already? I just noticed this function operates on an array rather than a single byte.