1*f14fb602SLionel Sambuc.\" $NetBSD: popcount.3,v 1.5 2011/08/22 01:36:04 dholland Exp $ 22fe8fb19SBen Gras.\" 32fe8fb19SBen Gras.\" Copyright (c) 2009 The NetBSD Foundation, Inc. 42fe8fb19SBen Gras.\" All rights reserved. 52fe8fb19SBen Gras.\" 62fe8fb19SBen Gras.\" This code is derived from software contributed to The NetBSD Foundation 72fe8fb19SBen Gras.\" by Joerg Sonnenberger. 82fe8fb19SBen Gras.\" 92fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without 102fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions 112fe8fb19SBen Gras.\" are met: 122fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright 132fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer. 142fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 152fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer in the 162fe8fb19SBen Gras.\" documentation and/or other materials provided with the distribution. 172fe8fb19SBen Gras.\" 182fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 192fe8fb19SBen Gras.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 202fe8fb19SBen Gras.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 212fe8fb19SBen Gras.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 222fe8fb19SBen Gras.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 232fe8fb19SBen Gras.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 242fe8fb19SBen Gras.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 252fe8fb19SBen Gras.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 262fe8fb19SBen Gras.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 272fe8fb19SBen Gras.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 282fe8fb19SBen Gras.\" POSSIBILITY OF SUCH DAMAGE. 292fe8fb19SBen Gras.\" 30*f14fb602SLionel Sambuc.Dd August 22, 2011 312fe8fb19SBen Gras.Dt POPCOUNT 3 322fe8fb19SBen Gras.Os 332fe8fb19SBen Gras.Sh NAME 342fe8fb19SBen Gras.Nm popcount , 352fe8fb19SBen Gras.Nm popcountl , 362fe8fb19SBen Gras.Nm popcountll , 372fe8fb19SBen Gras.Nm popcount32 , 382fe8fb19SBen Gras.Nm popcount64 392fe8fb19SBen Gras.Nd count number of bits set in a bit string 402fe8fb19SBen Gras.Sh LIBRARY 412fe8fb19SBen Gras.Lb libc 422fe8fb19SBen Gras.Sh SYNOPSIS 432fe8fb19SBen Gras.In strings.h 442fe8fb19SBen Gras.Ft unsigned int 452fe8fb19SBen Gras.Fn popcount "unsigned int value" 462fe8fb19SBen Gras.Ft unsigned int 472fe8fb19SBen Gras.Fn popcountl "unsigned long value" 482fe8fb19SBen Gras.Ft unsigned int 492fe8fb19SBen Gras.Fn popcountll "unsigned long long value" 50*f14fb602SLionel Sambuc.In stdint.h 512fe8fb19SBen Gras.Ft unsigned int 522fe8fb19SBen Gras.Fn popcount32 "uint32_t value" 532fe8fb19SBen Gras.Ft unsigned int 542fe8fb19SBen Gras.Fn popcount64 "uint64_t value" 552fe8fb19SBen Gras.Sh DESCRIPTION 562fe8fb19SBen GrasThe 572fe8fb19SBen Gras.Nm 582fe8fb19SBen Grasfunctions returns the number of bits set in 592fe8fb19SBen Gras.Fa value . 602fe8fb19SBen Gras.Sh SEE ALSO 612fe8fb19SBen Gras.Xr ffs 3 622fe8fb19SBen Gras.Sh HISTORY 632fe8fb19SBen GrasThe 642fe8fb19SBen Gras.Fn popcount , 652fe8fb19SBen Gras.Fn popcountl , 662fe8fb19SBen Gras.Fn popcountll , 672fe8fb19SBen Gras.Fn popcount32 , 682fe8fb19SBen Grasand 692fe8fb19SBen Gras.Fn popcount64 702fe8fb19SBen Grasfunctions appeared in 712fe8fb19SBen Gras.Nx 6.0 . 72