User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:logtest [2019/06/15 02:00]
cl:functions:logtest [2019/09/18 01:00] (current)
Line 1: Line 1:
 +====== Function LOGTEST ======
 +
 +====Syntax====
 +  * **logtest** //integer-1 integer-2// → //​generalized-boolean//​
 +
 +====Arguments and Values====
 +  * //​integer-1//​ - an //​[[CL:​Glossary:​integer]]//​.
 +  * //​integer-2//​ - an //​[[CL:​Glossary:​integer]]//​.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​.
 +
 +====Description====
 +Returns //​[[CL:​Glossary:​true]]//​ if any of the bits designated by the 1's in //​integer-1//​ is 1 in //​integer-2//;​ otherwise it is //​[[CL:​Glossary:​false]]//​. //​integer-1//​ and //​integer-2//​ are treated as if they were binary.
 +
 +Negative //​integer-1//​ and //​integer-2//​ are treated as if they were represented in two'​s-complement binary.
 +
 +====Examples====
 +<​blockquote>​
 +(logtest 1 7) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(logtest 1 2) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +(logtest -2 -1) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +(logtest 0 -1) <​r>//​[[CL:​Glossary:​false]]//​ </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Should signal an error of type type-error if //​integer-1//​ is not an //​[[CL:​Glossary:​integer]]//​. Should signal an error of type type-error if //​integer-2//​ is not an //​[[CL:​Glossary:​integer]]//​.
 +
 +====See Also====
 +None.
 +
 +====Notes====
 +<​blockquote> ​
 +(logtest //x// //y//) ≡ ([[CL:​Functions:​not]] ([[CL:​Functions:​zerop]] ([[CL:​Functions:​logand]] //x// //​y//​))) ​
 +</​blockquote>​
 +