ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   12 Numbers   12.2 Dictionary of Numbers

12.2.68 dpb Function

Syntax:
dpb newbyte bytespec integer    result-integer

Pronunciation:
[ 'dE'pib ] or [ 'dE'pEb ] or [ 'dê'pê'bê ]

Arguments and Values:
newbyte - an integer.

bytespec - a byte specifier.

integer - an integer.

result-integer - an integer.

Description:
dpb (deposit byte) is used to replace a field of bits within integer. dpb returns an integer that is the same as integer except in the bits specified by bytespec.

Let s be the size specified by bytespec; then the low s bits of newbyte appear in the result in the byte specified by bytespec. Newbyte is interpreted as being right-justified, as if it were the result of ldb.

Examples:
 (dpb 1 (byte 1 10) 0)  1024
 (dpb -2 (byte 2 10) 0)  2048
 (dpb 1 (byte 2 10) 2048)  1024

See Also:
byte, deposit-field, ldb

Notes:
 (logbitp j (dpb m (byte s p) n))
 ==(if (and (>= j p) (< j (+ p s)))
        (logbitp (- j p) m)
        (logbitp j n))

In general,

 (dpb x (byte 0 y) z)  z

for all valid values of x, y, and z.

Historically, the name "dpb" comes from a DEC PDP-10 assembly language instruction meaning "deposit byte."

Allegro CL Implementation Details:
None.

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2019 - File last updated 02-07-2019