《通链参考手册》


Accessor LDB

●语法设定:

ldb bytespec integer => byte

(setf (ldb bytespec place) new-byte)

●发音:

['lidib] or ['liduhb] or ['el'dee'bee]

●参数和值:

bytespec---a byte specifier.

integer---an integer.

byte, new-byte---a non-negative integer.

●详情:

ldb extracts and returns the byte of integer specified by bytespec.

ldb returns an integer in which the bits with weights 2^(s-1) through 2^0 are the same as those in integer with weights 2^(p+s-1) through 2^p, and all other bits zero; s is (byte-size bytespec) and p is (byte-position bytespec).

setf may be used with ldb to modify a byte within the integer that is stored in a given place. The order of evaluation, when an ldb form is supplied to setf, is exactly left-to-right. The effect is to perform a dpb operation and then store the result back into the place.

●例子:

 (ldb (byte 2 1) 10) =>  1
 (setq a (list 8)) =>  (8)
 (setf (ldb (byte 2 1) (car a)) 1) =>  1
 a =>  (10)

●副作用: None.

●受制于: 无。

●例外情况: 无。

●更多信息:

byte, byte-position, byte-size, dpb

●说明:

 (logbitp j (ldb (byte s p) n))
    ==  (and (< j s) (logbitp (+ j p) n))

In general,

 (ldb (byte 0 x) y) =>  0

for all valid values of x and y.

Historically, the name ``ldb'' comes from a DEC PDP-10 assembly language instruction meaning ``load byte.''


X3J13设计清单非标准部分,可查下面章节:


◇首页 § ◎章节目录 § □内容索引 § ○符号索引 § △术语表 § ※设计草案