There are a few additional arithmetic functions: (MASK.1'S ) returns a number equivalent to (llsh (sub1 (expt 2 size)) position), but faster, and without consing. Currently, the sume of and cannot exceed 32. (MASK.0'S ) is basically (logxor -1 (mask.1's position size)) These two functions use a diagonal array of pre-computed masks, which is accessed by \getbaseptr's over a 32-cell index array (this is to substitute for "fast" elt, since ELT isn't yet in microcode). Macro definitions for both funs cause all calls to MASK.1'S to turn into these "fast" elts. (POWEROFTWOP ) where is an integer, quickly returns its result. (INTEGERLENGTH ) is basically log2 of n; that is how long the integer representation of is when expressed in base 2. For example, (haulong 13) = 4; must be an integer, and for negative arguments, the result is the same as that of the absolute value. (HAIPART ) gets the high-order bits of the two's complement representation of the integer ; for negative , it gets the low-order <-n> bits. Note that "high-order" is not dependent on word size, but is derived from (HAULONG ). (IMOD ) returns where is in the closed interval [0, 1, ... < modulus-1>] and = m*+. NoteWell: this is *not* the same as the REMAINDER function, since is always non-negative. The argument may also be CELL or WORD, in which case the appropriate size is substituted to truncate to a cell-sized or word-sized integer. A macro definition for mod optimizes the case for compilation where is constant and is a power of two. (EVENP ) is true iff is 0 mod ; defaults to two if not supplied. Currently both arguments must be integers. A macro definition also does some compile-time optimization, particularly for the case where is a power of two. (ODDP ) is just (not (evenp )); has both expr and macro definition. (IMODLESSP ) This function is inspired by the need to use "wrap-around" counters. It is not possible to define a "perfect" ordering function on the integers [0, 1, ... ], but this function takes the view that it is better to limit the "diameter" of the applicable domain, than to "bump" into the singularity at the endpoints of the interval. So MODLESSP will return "true" iff - mod is less than 1/2*. The optional argument , if non-null, says to do a "less than or equal" test rather than a "lessp" test. Generally the should be a power of two (for faster running speed), but this isn't necessary. Two exceptional arguments are also admitted -- if is 'WORD, then the appropriate value is taken for word-sized arithmetic; if it is 'CELL, then the appropriate value is taken for double-word, or cell, sized arithmetic. In Interlisp-D, WORD sized is 16-bit, and CELL-sized is 32-bit. (TIMEREXPIRED? ) Basically, this function just calls MODLESSP with and and a modulus argument derived from the size of the clock behind the CLOCK function; however, if is omitted (or is NIL), it defaults to the value of (CLOCK 0), but without doing any consing. Typical usage is in implementing an "alarmclock". One will set some variable, say TIMEOUT, to (MODPLUS (CLOCK 0) ), and then frequently test (TIMELESSP TIMEOUT); when this test first becomes false, the timer, or "alarmclock", has expired. (IMODPLUS ) (IMODDIFFERENCE ) These two functions are essentially (MOD ( ) ), except no overflow is permitted to occur during the intermediate . A macro produces some slightly-optimized code for the case where is CELL. A current limitation is that an arithmetic overflow occurring when is not a power of two (or CELL or WORD) causes an error. (BITTEST ) is the CommonLisp function defined as (NEQ 0 (LOGAND )). (ROT ) is a slight extension of the CommonLisp ROT function; it performs a bitwise-rotation of the integer , by places, within a field of bits wide. The optional argument defaults to CELL, and must either be an integer in the range 1 to , or else be one of the litatoms CELL or WORD; in the latter two cases the quantities and are respectively substituted. A macro optimizes the case where is WORD and is 1; this is to help with the 16-bit rotate found in checksumming algorithms. ***** The remaining documentation is about \-named functions ****** The following two functions are essentially the CommonLisp functions LOAD-BYTE and DEPOSIT-BYTE, but without any error or consistency checking. There are versions with the checking, under similar, non-\ names, in another file (to be released at a later date). (\XLOADBYTE ) is derived from the PDP-10 LDB instruction; it takes a byte of length out of the integer which byte has bits to the right of it when is viewed in binary notation. (\XDEPOSITBYTE ) is derived from the PDP-10 DPB instruction; it does not "modify memory" however, but returns an integer obtained by replaceing the byte of as specified under LOADBYTE with the low-order bits of . The following four functions implement a feature that Ron asked for a long time ago, and probably should not be documented for random users, unless all the \-functions will be so documented: (\GETBASEBITS ) returns a integer obtained by starting at the word address , skipping over bits, and getting the next bits from memory. In this scenario, bits are numbered with 0 being the high-order position in the word, and with incresing bit-addresses leading to increasing word address. Thus bit address 15 is the low-order bit of some word, and bit address 16 is the high-order bit of the next word. The low-order bit of the result is obtained from the bit found at +-1 bits after bit 0 of the word at . This ordering of bits and bytes within a memor