1*15b02c1cSuwe.\" $NetBSD: bitops.3,v 1.6 2020/01/13 16:11:53 uwe Exp $ 2bd040c35Sjruoho.\" 3bd040c35Sjruoho.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi> 4bd040c35Sjruoho.\" All rights reserved. 5bd040c35Sjruoho.\" 6bd040c35Sjruoho.\" Redistribution and use in source and binary forms, with or without 7bd040c35Sjruoho.\" modification, are permitted provided that the following conditions 8bd040c35Sjruoho.\" are met: 9bd040c35Sjruoho.\" 1. Redistributions of source code must retain the above copyright 10bd040c35Sjruoho.\" notice, this list of conditions and the following disclaimer. 11bd040c35Sjruoho.\" 2. Redistributions in binary form must reproduce the above copyright 12bd040c35Sjruoho.\" notice, this list of conditions and the following disclaimer in the 13bd040c35Sjruoho.\" documentation and/or other materials provided with the distribution. 14bd040c35Sjruoho.\" 15bd040c35Sjruoho.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16bd040c35Sjruoho.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17bd040c35Sjruoho.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18bd040c35Sjruoho.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19bd040c35Sjruoho.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20bd040c35Sjruoho.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21bd040c35Sjruoho.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22bd040c35Sjruoho.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23bd040c35Sjruoho.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24bd040c35Sjruoho.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25bd040c35Sjruoho.\" POSSIBILITY OF SUCH DAMAGE. 26bd040c35Sjruoho.\" 27f8b5dc2cSjruoho.Dd December 4, 2012 28bd040c35Sjruoho.Dt BITOPS 3 29bd040c35Sjruoho.Os 30bd040c35Sjruoho.Sh NAME 31bd040c35Sjruoho.Nm bitops 32bd040c35Sjruoho.Nd functions related to bits and integers 33bd040c35Sjruoho.Sh SYNOPSIS 34bd040c35Sjruoho.In sys/bitops.h 35bd040c35Sjruoho.Sh DESCRIPTION 36bd040c35SjruohoThe 37bd040c35Sjruoho.In sys/bitops.h 38*15b02c1cSuweheader provides macros and 39*15b02c1cSuwe.Vt static inline 40e5909f15Sabhinavfunctions related to bits and integers. 41bd040c35SjruohoAmong these are: 42*15b02c1cSuwe.Bl -tag -width ".Xr fast_divide32 3" -offset indent 43f8b5dc2cSjruoho.It Xr bitmap 3 44f8b5dc2cSjruohobitmap manipulation macros 45*15b02c1cSuwe.It Xr fast_divide32 3 46*15b02c1cSuwea function for fast 32-bit division 47bd040c35Sjruoho.It Xr ffs32 3 48*15b02c1cSuwefunctions to find the first and last set bit in integers of type 49bd040c35Sjruoho.Vt uint32_t 50bd040c35Sjruohoand 51bd040c35Sjruoho.Vt uint64_t 52bd040c35Sjruoho.It Xr ilog2 3 539a991ffdSjruohoa macro for binary logarithm 54bd040c35Sjruoho.El 55bd040c35Sjruoho.Sh SEE ALSO 56bd040c35Sjruoho.Xr bits 3 , 579a991ffdSjruoho.Xr bitstring 3 , 58bd040c35Sjruoho.Xr cdefs 3 , 59bd040c35Sjruoho.Xr param 3 60bd040c35Sjruoho.Sh HISTORY 61bd040c35SjruohoThe 624f8cd38bSjruoho.In sys/bitops.h 63bd040c35Sjruohoheader first appeared in 64bd040c35Sjruoho.Nx 4.0 . 65