XLISP logand

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# logand

Type: | - | function (subr)
Source: | - | xlmath.c

## Syntax

(logand expr1 ... )
  expr - an integer expression
  returns - the result of the AND operation

## Description

The 'logand' function returns the logical bitwise 'and' of the list of expressions. If there is only one argument, it is returned unaltered. If there are two or more arguments, the 'logand' function performs the logical and operation successively applying the bitwise operation.

## Examples

    (logand 0 0)         ; returns 0
    (logand 0 1)         ; returns 0
    (logand 1 0)         ; returns 0
    (logand 1 1)         ; returns 1
    (logand 55 #x0F)     ; returns 7
    (logand 7 #b0011)    ; returns 3
    (logand 1 2 4 8 16)  ; returns 0
    (logand 15 7 3)      ; returns 3

Note: XLISP does not check when read-macro expansions like '#x0FF' are out of bounds. It gives no error message and will just truncate the number to the low-order bits that it can deal with [usually 32 bits or 8 hex digits].

See the logand function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference