Next: Fast Integer Calculations, Previous: SCM Primitive Procedures, Up: The Language Compiled [Contents][Index]
The following bitwise procedures in the scheme library file logical.scm are compiled directly to fast C operations on immediate integers (small 30-bit integers) (Scheme library funs in the upper row, C ops below):
logand logior logxor lognot logsleft logsright & | ^ ~ << >>
The following alternative names logical:logand, logical:logior, logical:logxor, logical:lognot, and ash are compiled for the generic case, not immediate-integers-only and are thus much slower.
Notice that the procedures logsleft, logsright are NOT in the the library file logical.scm: the universal procedure ash is instead. Procedures ash, logcount, integer-length, integer-expt, bit-extract, ipow-by-squaring, in logical.scm are not primtives and they are all compiled into calls to interpreted code.
logsleft and logsright are defined for non-compiled use in the file scmhob.scm included in the SCM distribution.