Document ilog2() from <sys/bitops.h>.

This commit is contained in:
jruoho 2010-06-08 08:51:08 +00:00
parent f9768510ca
commit a88b2930dc
3 changed files with 71 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1459 2010/06/08 05:40:26 jruoho Exp $
# $NetBSD: mi,v 1.1460 2010/06/08 08:51:08 jruoho Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -6175,6 +6175,7 @@
./usr/share/man/cat3/if_indextoname.0 comp-c-catman .cat
./usr/share/man/cat3/if_nameindex.0 comp-c-catman .cat
./usr/share/man/cat3/if_nametoindex.0 comp-c-catman .cat
./usr/share/man/cat3/ilog2.0 comp-c-catman .cat
./usr/share/man/cat3/ilogb.0 comp-c-catman .cat
./usr/share/man/cat3/ilogbf.0 comp-c-catman .cat
./usr/share/man/cat3/imaxabs.0 comp-c-catman .cat
@ -12046,6 +12047,7 @@
./usr/share/man/html3/if_indextoname.html comp-c-htmlman html
./usr/share/man/html3/if_nameindex.html comp-c-htmlman html
./usr/share/man/html3/if_nametoindex.html comp-c-htmlman html
./usr/share/man/html3/ilog2.html comp-c-htmlman html
./usr/share/man/html3/ilogb.html comp-c-htmlman html
./usr/share/man/html3/ilogbf.html comp-c-htmlman html
./usr/share/man/html3/imaxabs.html comp-c-htmlman html
@ -17835,6 +17837,7 @@
./usr/share/man/man3/if_indextoname.3 comp-c-man .man
./usr/share/man/man3/if_nameindex.3 comp-c-man .man
./usr/share/man/man3/if_nametoindex.3 comp-c-man .man
./usr/share/man/man3/ilog2.3 comp-c-man .man
./usr/share/man/man3/ilogb.3 comp-c-man .man
./usr/share/man/man3/ilogbf.3 comp-c-man .man
./usr/share/man/man3/imaxabs.3 comp-c-man .man

View File

@ -1,10 +1,11 @@
# $NetBSD: Makefile,v 1.54 2010/05/19 06:28:53 jruoho Exp $
# $NetBSD: Makefile,v 1.55 2010/06/08 08:51:09 jruoho Exp $
# @(#)Makefile 8.2 (Berkeley) 12/13/93
MAN= _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
__arraycount.3 assert.3 bits.3 bitstring.3 dirent.3 dlfcn.3 end.3 \
fast_divide32.3 ffs32.3 gcq.3 intro.3 inttypes.3 iso646.3 offsetof.3 \
queue.3 rb.3 sigevent.3 \
fast_divide32.3 ffs32.3 gcq.3 \
ilog2.3 intro.3 inttypes.3 iso646.3 \
offsetof.3 queue.3 rb.3 sigevent.3 \
stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
tgmath.3 timeradd.3 timeval.3 tree.3 types.3 varargs.3

63
share/man/man3/ilog2.3 Normal file
View File

@ -0,0 +1,63 @@
.\" $NetBSD: ilog2.3,v 1.1 2010/06/08 08:51:09 jruoho Exp $ $
.\"
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Jukka Ruohonen.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 8, 2010
.Os
.Dt ILOG2 3
.Sh NAME
.Nm ilog2
.Nd integer logarithm
.Sh SYNOPSIS
.In sys/bitops.h
.Ft size
.Fn ilog2 "size x"
.Sh DESCRIPTION
The
.Fn ilog2
macro returns an integer (binary) logarithm of
.Fa x .
It is the logarithm for base 2; the binary logarithm of
.Fa x
is the power to which the number 2 must be raised to obtain the value
.Fa x .
.Pp
The type of the input parameter should be either
.Vt uint32_t
or
.Vt uint64_t .
.Sh ERRORS
A value \-1 is returned on error.
.Sh SEE ALSO
.Xr log2 3 ,
.Xr imax 9
.Sh HISTORY
The
.Fn ilog2
macro first appeared in
.Nx 5.0 .