Integers as Bits [was Re: integer-length]
Aubrey Jaffer 07 Oct 2005 15:07 UTC
| From: Bradley Lucier <xxxxxx@math.purdue.edu>
| Date: Fri, 7 Oct 2005 12:47:01 +0200
|
| Jens Axel Søgaard writes:
|
| > I propose adding the following two operations on integers.
| >
| >
| > The first is INTEGER-LENGTH from CLHS
| >
| > <http://clhs.lisp.se/Body/f_intege.htm>
| >
| > which returns the number of bits needed to represent a given
| > integer in binary two's-complement format. Although it is
| > possible to define INTEGER-LENGTH as a library function, it will
| > be more efficient as a primitive, since it can exploit the
| > internal representation of an integer.
|
| Agree completely.
That would bring to 6 the number of procedures (of 19) imported from
SRFI-60 (and SRFI-33). Shall we continue piecemeal; or should the
incorporation of SRFI-60 procedures be considered in a more organized
fashion?
* bitwise-and
* bitwise-ior
* bitwise-xor
* bitwise-not
bitwise-merge
any-bits-set?
bit-count
* integer-length
first-set-bit
bit-set?
copy-bit
bit-field
copy-bit-field
* arithmetic-shift
rotate-bit-field
reverse-bit-field
integer->list
list->integer
booleans->integer