Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

powerof2(9) [netbsd man page]

ROUNDUP(9)						   BSD Kernel Developer's Manual						ROUNDUP(9)

roundup -- macros for counting and rounding SYNOPSIS
#include <sys/param.h> size howmany(x, size); size roundup(x, size); size rounddown(x, size); size roundup2(x, size); int powerof2(x); DESCRIPTION
The roundup() and rounddown() macros return an integer from rounding x up and down, respectively, to the next size. The howmany() macro in turn reveals how many times size fits into x, rounding the residual up. The roundup2() macro also rounds up, but with the assumption that size is a power of two. If x is indeed a power of two, powerof2() return 1. RETURN VALUES
The return value is an integer from the respective operation. If x is 0, all macros except powerof2() return 0. The behavior is undefined if size is 0. EXAMPLES
The following example rounds the variable rx to a 32-bit boundary: uint16_t rx; ... rx = roundup2(rx, sizeof(uint32_t)); SEE ALSO
ilog2(3), param(3), imax(9) CAVEATS
All described macros make no assumptions about the type of the parameters. These are implicitly assumed to be unsigned integers. BSD
June 1, 2011 BSD

Check Out this Related Man Page

PARAM(3)						   BSD Library Functions Manual 						  PARAM(3)

param -- common parameters SYNOPSIS
#include <sys/param.h> size MAX(size a, size b); size MIN(size a, size b); DESCRIPTION
The <sys/param.h> header includes some common definitions and macros specific to NetBSD. The header is perhaps best characterized as a ker- nel equivalent of <sys/types.h>. The following list summarizes the provided definitions and macros. o First and foremost, the header defines the version of NetBSD. This is defined as #define __NetBSD_Version__ 599004800 /* 5.99.48 */ The general format is ``MMmmrrpp00'', where 'MM' and 'mm' denote the major and minor version, respectively, 'rr' is provided for compatibility, and 'pp' defines the patch level. o Common utility macros such as MAX() and MIN() as well as more specific macros such as STACK(9), ctod(9), mstohz(9), roundup(9), and setbit(9). o Numerous miscellaneous definitions such as limits, constants for the kernel memoryallocators(9), scale factors used by the sched- uler, kthread(9) priorities, and many others. o Definitions provided for historical and compatibility reasons. Examples range from definitions such as ``#define BSD'' to old pri- ority levels used in the kernel. SEE ALSO
bitops(3), cdefs(3), types(3), unistd(3) HISTORY
A <param.h> header appeared already in the Version 4 AT&T UNIX. BSD
April 10, 2011 BSD
Man Page

4 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to get the size of process in Bytes

Hi All, We have the commands top and ps through which we can find out the size of the running process. These commnds are giving the size of my process in MB after rounding of the size. Is there any way by which I can get the size of my process in Bytes or KBytes. Any help would be greatly... (2 Replies)
Discussion started by: darshi
2 Replies

2. UNIX for Advanced & Expert Users

du -k shows different size in two nodes

After rcp -rp from remote host, using du -k to verify the file size but total file size have different size. Check on individual file, file size is correct. How can I confirm on the file size after ftp? Pls advise. Thank you. (15 Replies)
Discussion started by: KhawHL
15 Replies

3. Solaris

file size counts??

Hello experts, I do - $ ls -lhtr logs2007* Is it possible that i can get the results of- totals size in MB/KB for ALL "logs2007*" note: in the same directory I have "logs2006*" & "logs2007*" files. (4 Replies)
Discussion started by: thepurple
4 Replies

4. AIX

HACMP LV size is not reflecting

Hi i increased the lv size using smit hacmp. but, the new size is not reflecting.. why?. the pp size is 512 MB. before it was 4 PP's. i increased to 10 PP's. when i type df -m /xxx.. it is showing 2GB only. see the info below.. root@db:/ > df -m /xxx/xxx Filesystem MB blocks Free... (2 Replies)
Discussion started by: honeym210
2 Replies