Lines Matching defs:bit
20 * Utilities for treating {@code int[]}s as bit sets.
31 * Constructs a bit set to contain bits up to the given index (exclusive).
33 * @param max {@code >= 0;} the maximum bit index (exclusive)
42 * Gets the maximum index (exclusive) for the given bit set.
44 * @param bits {@code non-null;} bit set in question
52 * Gets the value of the bit at the given index.
54 * @param bits {@code non-null;} bit set to operate on
55 * @param idx {@code >= 0, < getMax(set);} which bit
56 * @return the value of the indicated bit
60 int bit = 1 << (idx & 0x1f);
61 return (bits[arrayIdx] & bit) != 0;
65 * Sets the given bit to the given value.
67 * @param bits {@code non-null;} bit set to operate on
68 * @param idx {@code >= 0, < getMax(set);} which bit
69 * @param value the new value for the bit
73 int bit = 1 << (idx & 0x1f);
76 bits[arrayIdx] |= bit;
78 bits[arrayIdx] &= ~bit;
83 * Sets the given bit to {@code true}.
85 * @param bits {@code non-null;} bit set to operate on
86 * @param idx {@code >= 0, < getMax(set);} which bit
90 int bit = 1 << (idx & 0x1f);
91 bits[arrayIdx] |= bit;
95 * Sets the given bit to {@code false}.
97 * @param bits {@code non-null;} bit set to operate on
98 * @param idx {@code >= 0, < getMax(set);} which bit
102 int bit = 1 << (idx & 0x1f);
103 bits[arrayIdx] &= ~bit;
107 * Returns whether or not the given bit set is empty, that is, whether
108 * no bit is set to {@code true}.
110 * @param bits {@code non-null;} bit set to operate on
126 * Gets the number of bits set to {@code true} in the given bit set.
128 * @param bits {@code non-null;} bit set to operate on
129 * @return {@code >= 0;} the bit count (aka population count) of the set
146 * @param bits {@code non-null;} bit set to operate on
147 * @param start {@code >= 0;} index of the first bit in the range (inclusive)
148 * @param end {@code >= 0;} index of the last bit in the range (exclusive)
149 * @return {@code true} if any bit is set to {@code true} in
158 * Finds the lowest-order bit set at or after the given index in the
159 * given bit set.
161 * @param bits {@code non-null;} bit set to operate on
163 * @return {@code >= -1;} lowest-order bit set at or after {@code idx},
164 * or {@code -1} if there is no appropriate bit index to return
185 * Finds the lowest-order bit set at or after the given index in the
189 * @param idx 0..31 the minimum bit index to return
190 * @return {@code >= -1;} lowest-order bit set at or after {@code idx},
191 * or {@code -1} if there is no appropriate bit index to return
200 * Ors bit array {@code b} into bit array {@code a}.