bitwise-bit-count - population count
(import (rnrs)) ;R6RS
(import (rnrs arithmetic bitwise)) ;R6RS
(import (rnrs arithmetic fixnums)) ;R6RS
If the argument is non-negative, this procedure returns the number
of 1 bits in its two's complement representation.
Otherwise it returns the result of the following computation:
(bitwise-not (bitwise-bit-count (bitwise-not ei)))
Returns a single exact integer object.
This procedure is used to compute the Hamming distance. It's also used
in Hash Array Mapped Tries and other applications.
This procedure is new in R6RS. SRFI-151 has the similar
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
the argument must be a fixnum.
This procedure can be implemented with the
procedure in x86-64 processors. This instruction appeared even in some
early computers like the IBM Stretch (1961).
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.