This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see BitwiseComparison in WG2's repo for R7RS-large.

Bitwise­Comparison

cowan
2012-04-12 11:47:34
3history
source

The following table compares the names of the bitwise (aka logical) functions of Common Lisp, SRFI 33, SRFI 60, R6RS, and BitwiseCowan. SRFI 33 was never finalized, but is a comprehensive proposal. SRFI 60 (based on SLIB) is smaller but has a few procedures of its own; some of its procedures have both native (often CL) and SRFI 33 names. R6RS is a subset of SRFI 60, but all procedure names begin with a bitwise- prefix.

Function

CL

SRFI 33

SRFI 60

R6RS

Cowan

Bitwise NOT

lognot

bitwise-not

lognot, bitwise-not

bitwise-not

bitwise-not

Bitwise AND (variadic)

logand

bitwise-and

logand, bitwise-and

bitwise-and

bitwise-and

Bitwise IOR (variadic)

logior

bitwise-ior

logior, bitwise-ior

bitwise-ior

bitwise-ior

Bitwise XOR (variadic)

logxor

bitwise-xor

logxor, bitwise-xor

bitwise-xor

bitwise-xor

Bitwise EQV (variadic)

logeqv

bitwise-eqv

---

---

bitwise-xor

Bitwise NAND (variadic*)

lognand

bitwise-nand

---

---

bitwise-nand

Bitwise NOR (variadic*)

lognor

bitwise-nor

---

---

bitwise-nor

Bitwise AND with NOT of first arg

logandc1

bitwise-andc1

---

---

bitwise-andc1

Bitwise AND with NOT of second arg

logandc2

bitwise-andc2

---

---

bitwise-andc2

Bitwise OR with NOT of first arg

logorc1

bitwise-orc1

---

---

bitwise-orc1

Bitwise OR with NOT of second arg

logorc2

bitwise-orc2

---

---

bitwise-orc2

Arithmetic shift

ash

arithmetic-shift

ash, arithmetic-shift

bitwise-arithmetic-shift

arithmetic-shift

Population count

logcount

bit-count

logcount, bit-count

bitwise-bit-count

bit-count

Integer length

integer-length

integer-length

integer-length

bitwise-integer-length

integer-length

Mask selects source of bits

---

bitwise-merge

bitwise-if, bitwise-merge

bitwise-if

bitwise-if

Test single bit

logbitp

bit-set?

logbit?, bit-set?

bitwise-bit-set?

bit-set?

See if any mask bits set

logtest

any-bits-set?†â€

logtest, any-bit-set?

---

See if all mask bits set

---

all-bits-set?†â€

---

---

every-bit-set?

Replace single bit

---

---

copy-bit

bitwise-copy-bit

copy-bit

Find first bit set

---

first-set-bit

log2-binary-factors, first-set-bit

---

first-set-bit

Extract bit fieldâ€

ldb

extract-bit-field†â€

bit-field

bitwise-bit-field

bit-field

Test bit fieldâ€

ldb-test

test-bit-field?†â€

---

---

---

Clear bit field

mask-field

clear-bit-field†â€

---

---

---

Replace bit fieldâ€

dpb

replace-bit-field†â€

copy-bit-field

bitwise-copy-bit-field

bit-field-copy

Replace corresponding bit field

deposit-field

copy-bit-field†â€

---

---

bit-field-copy-same

Rotate bit field

---

---

rotate-bit-field

bitwise-rotate-bit-field

bit-field-rotate

Reverse bit field

---

---

reverse-bit-field

bitwise-reverse-bit-field

bit-field-reverse

Integer to boolean list

---

---

integer->list

---

integer->list

Boolean list to integer

---

---

list->integer

---

list->integer

Booleans to integer

---

---

booleans->integer

---

bits

*These procedures were made dyadic in late revisions to SRFI 33 that were never consummated. BitwiseCowan adopts this change.

†These procedures take a byte-spec object in Common Lisp (which encodes size and position), leading size and position arguments in SRFI-33, and trailing start and end arguments in SRFI-60, R6RS (where present), and BitwiseCowan. Consequently, they are not quite compatible across specifications. Note that copy-bit-field corresponds to different procedures in SRFI 33 and SRFI 60.

††These procedures got new names in Olin's revisions:

any-bits-set?

any-bit-set?

all-bits-set?

every-bit-set?

extract-bit-field

bit-field-extract

test-bit-field?

bit-field-any?

---

bit-field-every?

clear-bit-field

bit-field-clear

replace-bit-field

bit-field-replace

copy-bit-field

bit-field-copy

BitwiseCowan adopts some of these name changes.