GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
max_pow2.c
Go to the documentation of this file.
1
#include <grass/gis.h>
2
#include <grass/gmath.h>
3
4
16
long
G_math_max_pow2
(
const
long
n)
17
{
18
long
p2, n1;
19
20
n1 = n >> 1;
21
p2 = 1;
22
while
(n1 > 0) {
23
n1 >>= 1;
24
p2 <<= 1;
25
}
26
if
(p2 < n)
27
p2 <<= 1;
28
29
return
(p2);
30
}
31
32
44
long
G_math_min_pow2
(
const
long
n)
45
{
46
long
p2, n1;
47
48
n1 = n >> 1;
49
p2 = 1;
50
while
(n1 > 0) {
51
n1 >>= 1;
52
p2 <<= 1;
53
}
54
55
return
(p2);
56
}
lib
gmath
max_pow2.c
Generated on Sat Oct 5 2013 12:11:09 for GRASS Programmer's Manual by
1.8.4