[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Integers as Bits [was Re: integer-length]

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.



 | From: Bradley Lucier <lucier@xxxxxxxxxxxxxxx>
 | 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