Fast sets for small integers and enumerations, implemented as bit operations on Long There may be at most 64 elements, due to the bit size of Long.
a `difference` b -- a set with all elements that are members of a and not members of b
a `differenceE` e = a `difference` {e}
convert a list to a BitSet
a `intersection` b -- a set with all elements that are members of a and members of b
a `intersectionE` e = a `intersection` {e}
Predicate to tell if an element is a member of a set
access field set
A set with one argument
tell the number of elements in a BitSet
Predicate that tells if one set is a subset of another
convert a BitSet to a list
a `union` b -- a set with all elements that are members of a or members of b
a `unionE` e = a `union` {e}
The universal set
The Bits class defines bitwise operations over integral types.
Bits are numbered from 0 with bit 0 being the least significant bit.
Minimal complete definition: .&., .|., .^., Bits.complement, (Bits.shift or (Bits.shiftL and Bits.shiftR)), (Bits.rotate or (Bits.rotateL and Bits.rotateR)), Bits.bitSize and Bits.isSigned.
Bitwise \"and\"
Bitwise \"xor\"
Bitwise \"or\"
bit i is a value with the ith bit set
Returns the number of one-bits in the two's complement binary representation of the specified value.
Also known as "population count" or "Hamming Weight" of a bit string.
See also Hamming Weight.
Return the number of bits in the type of the argument. The actual value of the argument is ignored. The function Bits.bitSize is undefined for types that do not have a fixed bitsize, like Integer.
x \`clearBit\` i is the same as x .&. complement (bit i)
Reverse all the bits in the argument
x \`complementBit\` i is the same as x \`.^.\` bit i
Return true if the argument is a signed type. The actual value of the argument is ignored
Bits.rotate x i rotates x left by i bits if i is positive, or right by -i bits otherwise.
For unbounded types like Integer, Bits.rotate is equivalent to Bits.shift.
An instance can define either this unified Bits.rotate or Bits.rotateL and Bits.rotateR, depending on which is more convenient for the type in question.
Rotate the argument left by the specified number of bits (which must be non-negative).
An instance can define either this and Bits.rotateR or the unified Bits.rotate, depending on which is more convenient for the type in question.
Rotate the argument right by the specified number of bits (which must be non-negative).
An instance can define either this and Bits.rotateL or the unified Bits.rotate, depending on which is more convenient for the type in question.
x \`setBit\` i is the same as x .|. bit i
Bits.shift x i shifts x left by i bits if i is positive, or right by -i bits otherwise. Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x is negative and with 0 otherwise.
An instance can define either this unified Bits.shift or Bits.shiftL and Bits.shiftR, depending on which is more convenient for the type in question.
Shift the argument left by the specified number of bits (which must be non-negative).
An instance can define either this and Bits.shiftR or the unified Bits.shift, depending on which is more convenient for the type in question.
Shift the first argument right by the specified number of bits (which must be non-negative). Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x is negative and with 0 otherwise.
An instance can define either this and Bits.shiftL or the unified Bits.shift, depending on which is more convenient for the type in question.
Return true if the nth bit of the argument is 1
Unsigned shift right
Haskell compatibility. Same as `.^.`
Computes binary /and/ of two integers. Uses the java &-operator.
Computes binary /exclusive or/ of two integers. Uses the java ^-operator.
Computes binary /or/ of two integers. Uses the java |-operator.
inherited from Bits.bit
inherited from Bits.clearBit
inherited from Bits.complementBit
inherited from Bits.rotate
Returns the value obtained by rotating the two's complement binary representation of the specified int value left
by the specified number of bits.
Returns the value obtained by rotating the two's complement binary representation of the specified int value
right by the specified number of bits.
inherited from Bits.setBit
inherited from Bits.shift
inherited from Bits.testBit
unsigned right shift
inherited from Bits.xor
inherited from Bits.bit
Returns the number of bits in the two's complement representation of this Integer that differ from its sign bit.
Note that this is slightly different from data types with a fixed bit size!
Best to be used after masking a certain number of bits with some all-1-bit pattern.
Returns the number of bits in the minimal two's-complement representation of this Integer, excluding a sign bit.
inherited from Bits.clearBit
inherited from Bits.complementBit
inherited from Bits.rotateL
inherited from Bits.rotateR
inherited from Bits.setBit
inherited from Bits.shift
inherited from Bits.testBit
unsigned right shift on big integers does not really make sense ...
inherited from Bits.xor
Computes binary and of two integers. Uses the java &-operator.
Computes binary exclusive or of two long integers. Uses the java ^-operator.
Computes binary or of two long integers. Uses the java |-operator.
inherited from Bits.bit
inherited from Bits.clearBit
inherited from Bits.complementBit
inherited from Bits.rotate
Returns the value obtained by rotating the two's complement binary representation
of the specified long value left by the specified number of bits.
Returns the value obtained by rotating the two's complement binary representation
of the specified long value right by the specified number of bits.
inherited from Bits.setBit
inherited from Bits.shift
inherited from Bits.testBit
unsigned right shift
inherited from Bits.xor
inherited from Eq.!=
The empty set
Predicate to tell if the set is empty
inherited from Monoid.mconcat
inherited from Monoid.mtimes
inherited from Semigroup.sconcat
inherited from Semigroup.stimes
inherited from Ord.<
inherited from Ord.<=
inherited from Ord.>
inherited from Ord.>=
inherited from Ord.compare
inherited from Ord.max
inherited from Ord.min
inherited from Show.display
inherited from Show.showChars
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
Bits_Int.xor, Bits_Int.shift, Bits_Int.rotate, Bits_Int.complementBit, Bits_Int.clearBit, Bits_Int.setBit
Bits_Integer.shift, Bits_Integer.rotateR, Bits_Integer.rotate, Bits_Integer.rotateL, Bits_Integer.setBit, Bits_Integer.clearBit, Bits_Integer.complementBit
Bits_Long.shift, Bits_Long.rotate, Bits_Long.complementBit, Bits_Long.clearBit, Bits_Long.setBit
Eq_BitSet.!=, Eq_BitSet.==, Ord_BitSet.>=, Ord_BitSet.<, Ord_BitSet.<=, Ord_BitSet.>
Bits.ushiftR, Bits.shiftL, Bits.setBit, Bits.rotateR, Bits.shift, Bits.shiftR, Bits.rotate, Bits.clearBit, Bits.complementBit, Bits.rotateL