1roundup(3)                 Library Functions Manual                 roundup(3)
2
3
4

NAME

6       roundup - round up in steps
7

LIBRARY

9       Standard C library (libc)
10

SYNOPSIS

12       #include <sys/param.h>
13
14       roundup(x, step);
15

DESCRIPTION

17       This  macro  rounds  x to the nearest multiple of step that is not less
18       than x.
19
20       It is typically used for rounding up a pointer to align it or  increas‐
21       ing a buffer to be allocated.
22
23       This  API is not designed to be generic, and doesn't work in some cases
24       that are not important for the typical use cases described above.   See
25       CAVEATS.
26

RETURN VALUE

28       This macro returns the rounded value.
29

STANDARDS

31       None.
32

CAVEATS

34       The arguments may be evaluated more than once.
35
36       x should be nonnegative, and step should be positive.
37
38       If x + step would overflow or wrap around, the behavior is undefined.
39

SEE ALSO

41       ceil(3), floor(3), lrint(3), rint(3), lround(3), round(3)
42
43
44
45Linux man-pages 6.04              2023-03-30                        roundup(3)
Impressum