《通链参考手册》


Function LOGBITP

●语法设定:

logbitp index integer => generalized-boolean

●参数和值:

index---a non-negative integer.

integer---an integer.

generalized-boolean---a generalized boolean.

●详情:

logbitp is used to test the value of a particular bit in integer, that is treated as if it were binary. The value of logbitp is true if the bit in integer whose index is index (that is, its weight is 2^index) is a one-bit; otherwise it is false.

Negative integers are treated as if they were in two's-complement notation.

●例子:

 (logbitp 1 1) =>  false
 (logbitp 0 1) =>  true
 (logbitp 3 10) =>  true
 (logbitp 1000000 -1) =>  true
 (logbitp 2 6) =>  true
 (logbitp 0 6) =>  false

●副作用: None.

●受制于: 无。

●例外情况:

Should signal an error of type type-error if index is not a non-negative integer. Should signal an error of type type-error if integer is not an integer.

●更多信息: None.

●说明:

 (logbitp k n) ==  (ldb-test (byte 1 k) n)


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


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