XLISP lognot

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

# lognot

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

## Syntax

(lognot expr)
  expr - an integer expression
  returns - the bitwise inversion of number

## Description

The 'lognot' function returns the logical bitwise inversion of the expression.

## Examples

    (lognot 255)                 ; returns -256
    (lognot #xffff0000)          ; returns 65535
    (lognot #x00000000)          ; returns -1
    (lognot 1)                   ; returns -2

    (logand (lognot 256) 65535)  ; returns 65279
    (lognot #xFFFFFFFE)          ; returns 1
    (lognot #xFFFFFFFC)          ; 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 lognot function in the XLISP 2.0 manual.

Back to Top

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