More extensions to Interlisp-D arithmeticThe following "logical" arithmetic functions are derived from Common Lisp, and have both macro and function definitions (the macros are for speed in running of compiled code). The following code equivalences are primarily for definitional purposes, and should not be considered an implementation(especially since the ireal implementation tends to be faster and less "consy" than apparent here).(LOGNOT x) == (LOGXOR x -1)(BITTEST x mask) == (NOT (ZEROP (LOGAND x mask)))(BITCLEAR x mask) == (LOGAND x (LOGNOT mask))(BITSET x mask) == (LOGOR x mask)(MASK.1'S pos size) == (LLSH (SUB1 (EXPT 2 size) pos)(MASK.0's pos size) == (LOGNOT (MASK.1'S pos size))(LOADBYTE x pos size)== (LOGAND (LRSH x pos) (MASK.1'S 0 size))(DEPOSITBYTE x pos size byte)== (LOGOR (BITCLEAR x (MASK.1'S pos size))(LLSH (LOGAND byte (MASK.1'S 0 size)) pos))The notion of a "byte specifier" has been added; from a pair of positon and size arguments, a byte-spec is constructed by the macro BYTE [note reversal of arguments as compare with above functions](BYTE size pos)Similarly, the macros BYTESIZE and BYTEPOSITION will select out the twofields. [currently, byte-specs are implemented as a typerecord; Common Lispleaves unspecified whether there are any range limitations on "size" or "pos"]Two more "byte" functions are provided, with compiler macro support also:(LDB bspec val)== (LOADBYTE val (BYTEPOSITION bspec) (BYTESIZE bspec))(DPB n bspec val) == (DEPOSITBYTE val (BYTEPOSITION bspec) (BYTESIZE bspec) n)The final function in this series is not quite so easy to describe -- ROT for "Rotate bits in field". (ROT x n fieldsize)is a slight extension of the CommonLisp ROT function. It performs a bitwise left-rotation of the integer x, by n places, within a field of fieldsize bits wide; bits being shifted out of the position selected by (EXPT 2 (SUB1 fieldsize)) will flow into the "units" position. The optional argument fieldsize defaults to "cell" size (the integerlength of the current maximum fixp), and must eitherbe a positive integer, or else be one of the litatoms CELL or WORD. In the latter two cases the appropriate numerical values are respectively substituted.A macro optimizes the case where fieldsize is WORD and n is 1.newarITH.TTY12-Jul-83 23:41:53Page 1 a)^E ]M [wM YI X]G V S , R),! P, O, M," K, Jh,+ H,GN+'tE+ BL AL ?- L> h. "Et  BNGACHA]H]G *<---- gpxggAgoggg^gogeg|p&g'gpg'g|gpDggog'g\gxg'\g eh@ "gg"h:W EMPRESS.RUN9,9,~|~ g*h!?;@x9,ٓ~g𾴓?9,g9,~hhhhoses, and should not be considered an implementation (especially since the ireal implementation tends to be faster and less "consy" than apparent here). (LOGNOT x) == (LOGXOR x -1) (BITTEST x mask) == (NOT 3hj---------hffI :4:4:5:6:9RR_h~ ;6jjARITH.TTYjjFOS>NEWARITH.TTY;2 to local file NEWARITH.TTY [New file]%IiI Retrieve=hZZ9>Z%8i8=_  ServerH-+=SZZ9'j/ ;newarith.press :4JonL.pa12-Jul-83 23:41:53