Node:Lisp Number Operations,
Previous:Lisp support,
Up:Lisp support
Lisp Number Operations
(Section numbers refer to: Guy Steel jr. "Common Lisp: The Language",
second edition, 1990.)
The "Predicates on Numbers" (from Section 12.2) are all implemented.
|
True if number is positive
|
|
True of number is negative
|
The "Logical Operations on Numbers" (from Section 12.7) are all implemented.
These all consider an integer as a semi-infinite bit string.
| logior &rest integers
|
Function |
|
Take the "inclusive or" of the integers.
|
| logxor &rest integers
|
Function |
|
Take the "exclusive or" of the integers.
|
| logand &rest integers
|
Function |
|
Take the logical "and" of the integers.
|
| logeqv &rest integers
|
Function |
|
Take the "exclusive nor" (bit-wise logival equivalence) of the integers.
|
| lognand integer1 integer2
|
Function |
Same as (lognot (logand integer1 integer2)).
|
| lognor integer1 integer2
|
Function |
Same as (lognot (logor integer1 integer2)).
|
| logandc1 integer1 integer2
|
Function |
Same as (logand (lognot integer1) integer2).
|
| logandc1 integer1 integer2
|
Function |
Same as (logand (lognot integer1) integer2).
|
| logandc2 integer1 integer2
|
Function |
Same as (logand integer1 (lognot integer2)).
|
| logorc1 integer1 integer2
|
Function |
Same as (logor (lognot integer1) integer2).
|
| logorc2 integer1 integer2
|
Function |
Same as (logor integer1 (lognot integer2)).
|
| boole operation integer1 integer2
|
Function |
|
Does the bit-wise boolean operation indicated by operation,
on the two operands integer1 and integer2.
The operation is one of the 16 constants below.
|
|
Returns the bit-wise logical "not" of integer.
|
| logtest integer1 integer2
|
Function |
Same as (not (zerop (logand integer1 integer2))).
|
| logbitp index integer
|
Function |
|
True iff bit number index in integer is one.
|
| ash integer count
|
Function |
Does an arithmetic shift by count on integer.
Shift left is count is positive; otherwise, shift right.
|
| logcount integer
|
Function |
|
Count the number of 1-bits in integer, if it is non-negative.
If integer is negative, count number of 0-bits.
|
| integer-count integer
|
Function |
|
Return number of bits needed to represent integer.
|