summaryrefslogtreecommitdiff
path: root/doc/lispref/numbers.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref/numbers.texi')
-rw-r--r--doc/lispref/numbers.texi13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 3fdc94169bd..5058063af4d 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -1107,6 +1107,19 @@ bit is one in the result if, and only if, the @var{n}th bit is zero in
@end example
@end defun
+@cindex popcount
+@cindex Hamming weight
+@cindex counting set bits
+@defun logcount integer
+This function returns the @dfn{Hamming weight} of @var{integer}: the
+number of ones in the binary representation of @var{integer}.
+
+@example
+(logcount 42) ; 42 = #b101010
+ @result{} 3
+@end example
+@end defun
+
@node Math Functions
@section Standard Mathematical Functions
@cindex transcendental functions