Unix and Linux Discussions Tagged with file size |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
17 |
4,072 |
Shell Programming and Scripting |
|
|
|
8 |
2,832 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
4,605 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
5,627 |
Shell Programming and Scripting |
|
|
|
7 |
8,996 |
Shell Programming and Scripting |
|
|
|
4 |
12,505 |
Shell Programming and Scripting |
|
|
|
1 |
4,607 |
UNIX for Advanced & Expert Users |
|
|
|
2 |
19,727 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
7,222 |
Shell Programming and Scripting |
|
|
|
2 |
12,960 |
Shell Programming and Scripting |
|
|
|
12 |
5,562 |
UNIX for Dummies Questions & Answers |
|
|
|
0 |
3,400 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
7,844 |
Shell Programming and Scripting |
|
|
|
4 |
4,615 |
UNIX for Dummies Questions & Answers |
|
|
|
10 |
13,682 |
Shell Programming and Scripting |
|
|
|
3 |
4,860 |
Solaris |
|
|
|
1 |
19,563 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
8,488 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
74,014 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
30,898 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,033 |
UNIX for Dummies Questions & Answers |
|
|
|
11 |
18,857 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
3,444 |
Shell Programming and Scripting |
|
|
|
4 |
2,351 |
Solaris |
|
|
|
1 |
65,965 |
Shell Programming and Scripting |
|
|
|
3 |
6,196 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,819 |
UNIX for Advanced & Expert Users |
|
|
|
3 |
13,633 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
2,853 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
5,890 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
16,072 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
4,992 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
7,559 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
3,416 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
4,796 |
UNIX for Dummies Questions & Answers |
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 parameters. These are implicitly assumed to be unsigned integers.
BSD
June 1, 2011 BSD