GNU Info

Info Node: (librep.info)Bitwise Functions

(librep.info)Bitwise Functions


Next: Numeric Predicates Prev: Mathematical Functions Up: Numbers
Enter node , (file) or (file)node

Bitwise Functions
-----------------

   These functions operate on the bit string which an integer
represents, assuming a two's complement representation.

 - Function: lsh number count
     This function shifts the integer NUMBER COUNT bits to the left, if
     COUNT is negative NUMBER is shifted to the right instead.

          (lsh 1 8)
              => 256
          
          (lsh 256 -8)
              => 1

 - Function: logand number1 #!rest numbers
     This function uses a bit-wise logical `and' operation to combine
     all its arguments (there must be at least one argument).

          (logand 15 8)
              => 8
          
          (logand 15 7 20)
              => 4

 - Function: logior number1 #!rest numbers
     Uses a bit-wise logical `inclusive-or' to combine all its
     arguments (there must always be at least one argument).

          (logior 1 2 4)
              => 7

 - Function: logxor number1 #!rest numbers
     Uses a bitwise logical `exclusive-or' to combine all its arguments
     (there must be at least one).

          (logxor 7 3)
              => 4

 - Function: lognot number
     This function inverts all the bits in NUMBER.

          (lognot 0)
              => -1
          
          (lognot 2)
              => -3
          
          (lognot -1)
              => 0


automatically generated by info2www version 1.2.2.9