ILOG2(3) NetBSD Library Functions Manual ILOG2(3)NAME

ilog2-- integer base-2 logarithmSYNOPSIS

#include <sys/bitops.h>intilog2(size x);DESCRIPTION

For positivex, theilog2() macro returns the integer part of the base-2 logarithm ofx; that is,floor(log_2(x) ). Ifn=ilog2(x), thennis the largest integer such that 2**n<=x; in other words,ilog2() returns the largest integer to which 2 can be raised to obtain a value at mostx. The type of the input parameter must be unsigned. Ifxis a constant expression, then so isilog2(x).ERRORS

ilog2() returns -1 whenxis zero.SEE ALSO

bitops(3), ffs(3), ilogb(3), log2(3), imax(9), powerof2(9)HISTORY

Theilog2() macro first appeared in NetBSD 5.0. NetBSD 10.99 November 5, 2021 NetBSD 10.99

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.