From 791a2749886f02ec7b8db25bf8862e8269b96da5 Mon Sep 17 00:00:00 2001
From: Harvey Harrison
+ *
* IntBitfield allows convenient access of a wide field of transient bits using efficient storage in O(1).
*
* It can be used e.g. to map key-codes to pressed-state etc.
- *
true
if the bit at position bitnum
is set, otherwise false
. */
public final boolean get(long bitnum) {
check(bitnum);
@@ -88,7 +88,7 @@ public class IntBitfield {
final int b = (int) ( bitnum - ( (long)u << UNIT_SHIFT_L ) );
return 0 != ( storage[u] & ( 1 << b ) ) ;
}
-
+
/** Return true
if the bit at position bitnum
is set, otherwise false
. */
public final boolean get(int bitnum) {
check(bitnum);
@@ -96,12 +96,12 @@ public class IntBitfield {
final int b = bitnum - ( u << UNIT_SHIFT_I );
return 0 != ( storage[u] & ( 1 << b ) ) ;
}
-
- /**
+
+ /**
* Set or clear the bit at position bitnum
according to bit
- * and return the previous value.
+ * and return the previous value.
*/
- public final boolean put(long bitnum, boolean bit) {
+ public final boolean put(long bitnum, boolean bit) {
check(bitnum);
final int u = (int) ( bitnum >> UNIT_SHIFT_L );
final int b = (int) ( bitnum - ( (long)u << UNIT_SHIFT_L ) );
@@ -116,12 +116,12 @@ public class IntBitfield {
}
return prev;
}
-
- /**
+
+ /**
* Set or clear the bit at position bitnum
according to bit
- * and return the previous value.
+ * and return the previous value.
*/
- public final boolean put(int bitnum, boolean bit) {
+ public final boolean put(int bitnum, boolean bit) {
check(bitnum);
final int u = bitnum >> UNIT_SHIFT_I;
final int b = bitnum - ( u << UNIT_SHIFT_I );
@@ -151,8 +151,8 @@ public class IntBitfield {
c -= (n >> 2) & 011111111111;
return ( (c + ( c >> 3 ) ) & 030707070707 ) % 63;
}
-
- /**
+
+ /**
* Returns the number of set bits within this bitfield.
*/
public long getBitCount() {
--
cgit v1.2.3