from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

209580

userrating:


May 25th. 2007:
Words

486

Views

258587

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

149876

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





powerof2

Section: C Library Functions (3)
Updated: 202-0-17
Index Return to Main Contents
 

NAME

powerof2 - test if a value is a power of 2  

LIBRARY

Standard C library (libc)  

SYNOPSIS

#include <sys/param.h>
int powerof2(x);
 

DESCRIPTION

This macro returns true if x is a power of 2, and false otherwise. 0 is considered a power of 2. This can make sense considering wrapping of unsigned integers, and has interesting properties.  

RETURN VALUE

True or false, if x is a power of 2 or not, respectively.  

STANDARDS

BSD.  

CAVEATS

The arguments may be evaluated more than once. Because this macro is implemented using bitwise operations, some negative values can invoke undefined behavior. For example, the following invokes undefined behavior: powerof2(INT_MIN);. Call it only with unsigned types to be safe.  

SEE ALSO

stdc_bit_ceil(3), stdc_bit_floor(3)


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
RETURN VALUE
STANDARDS
CAVEATS
SEE ALSO





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 15.2 ms