logical - logical (bitwise) operations $Id: README,v 1.3 2000/02/17 11:05:42 shiro Exp $ This is a native implementation of logical operations for STk. The functions are the same as slib's logical feature, only faster. The newest of this document can be obtained at http://practical-scheme.net/vault/logical.txt The newest version of this library is 0.2. INSTALL ======= (1) ungzip and untar the package. You'll get "logical" subdirectory. (2) cd logical (3) stk Makefile.stk (4) make (5) make test (6) make install Note for mp library: the Makefile needs to know which version of mp library (gmp or fgmp) you're using for your stk. By default it looks into your stk library directory and if it finds libfgmp.a it assumes you're using fgmp, otherwise gmp. You can manually tweak the Makefile generated by step (3). Change the definitions of DFLGS and LIBS. Note: the author hasn't tested the library with libfgmp. PROCEDURES ========== (logand NUM1 NUM2) Returns logical and of two exact integers NUM1 and NUM2. (logior NUM1 NUM2) Returns logical or of two exact integers NUM1 and NUM2. (logxor NUM1 NUM2) Returns logical xor of two exact integers NUM1 and NUM2. (lognot NUM) Returns logical not (1's complement) of an exact integer NUM (logtest MASK NUM) Returns ((MASK & NUM) != 0), in C term. (logbit? INDEX NUM) Returns true if INDEX-th bit of an exact integer NUM is 1, false otherwise. (ash NUM CNT) Shifts NUM arithmetic by count CNT. If CNT is positive, it shifts to left. If CNT is negative , it shifts to right. (copy-bit INDEX NUM BOOL) Sets/resets INDEX-th bit of an exact integer NUM if BOOL is true/false, respectively. (integer-length NUM) Returns number of bits required to represent an exact integer NUM. (bit-field NUM START END) (bit-extract NUM START END) Returns an exact integer which is from START-th bit to (END-1)-th bit of NUM. END must be larger than or equal to START. (copy-bit-field TO START END FROM) Returns an exact integer which is equal to TO except whose START-th bit to (END-1)-th bit is replaced by FROM. (logcount NUM) Returns # of set bit (or unset bit if NUM is negative) in NUM. (integer-expt NUM) The same as expt. For compatibility.