Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ xor(3F) — NEWS-os 3.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

BIT(3F)  —  UNIX Programmer’s Manual

NAME

bit − and, or, xor, not, rshift, lshift bitwise functions

SYNOPSIS

(intrinsic) function and (word1, word2) (intrinsic) function or (word1, word2) (intrinsic) function xor (word1, word2) (intrinsic) function not (word) (intrinsic) function rshift (word, nbits) (intrinsic) function lshift (word, nbits)

DESCRIPTION

These bitwise functions are built into the compiler and return the data type of their argument(s).  Their arguments must be integer or logical values. 

The bitwise combinatorial functions return the bitwise “and” (and), “or” (or), or “exclusive or” (xor) of two operands.  Not returns the bitwise complement of its operand. 

lshift is a logical left shift. On the other hand, rshift is an arithmatic right shift with sign extension.  Both functions can perform bit shift following the value of nbits modulo 64.  For example, 64 means none shift, −1 causes 63 shifts and so forth. 
This specification comes from that of ASL/ASR instructions of MC68020/68030. Take notice that the meaning of negative value of nbits is differnt from VAX family.

These functions may be used to create a variety of general routines, as in the following statement function definitions: integer bitset, bitclr, getbit, word, bitnum bitset( word, bitnum ) = or(word,lshift(1,bitnum))
bitclr( word, bitnum ) = and(word,not(lshift(1,bitnum)))
getbit( word, bitnum ) = and(rshift(word,bitnum),1)

FILES

These functions are generated in-line by the f77 compiler. 

NEWS-OSRelease 3.3

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026