Node:Logical Number Operations,
Next:Strings,
Previous:Quantities,
Up:Extensions
Logical Number Operations
These functions operate on the 2's complement binary representation
of an exact integer.
Returns the bit-wise logical "and" of the arguments.
If no argument is given, the result is -1.
|
Returns the bit-wise logical "(inclusive) or" of the arguments.
If no argument is given, the result is 0.
|
Returns the bit-wise logical "exclusive or" of the arguments.
If no argument is given, the result is 0.
|
Returns the bit-wise logical inverse of the argument.
|
Perform one of the 16 bitwise operations of x and y,
depending on op.
|
Returns true if the arguments have any bits in common.
Same as (not (zero? (logand i j))) ,
but is more efficient.
|
Returns #t iff the bit numbered pos in i is one.
|
arithmetic-shift i j
|
Function |
Shifts i by j.
It is a "left" shift if j>0 , and
a "right" shift if j<0 .
The result is equal to (floor (* i (expt 2 j))) .
|
Alias for arithmetic-shift .
|
Count the number of 1-bits in i, if it is non-negative.
If i is negative, count number of 0-bits.
|
integer-length i
|
Function |
Return number of bits needed to represent i in an unsigned field.
Regardless of the sign of i, return one less than the number of bits
needed for a field that can represent i as a two's complement integer.
|
bit-extract n start end
|
Function |
Return the integer formed from the (unsigned) bit-field
starting at start and ending just before end.
Same as (arithmetic-shift (bitand n (bitnot (arithmetic-shift -1 end))) (- start)) .
|