roundup man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

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

NAME
     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 parame‐
     ters.  These are implicitly assumed to be unsigned integers.

BSD				 June 1, 2011				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net