GRASS GIS 7 Programmer's Manual
7.8.2(2019)-exported
xshiftru.c
Go to the documentation of this file.
1
2
#include <grass/gis.h>
3
#include <grass/raster.h>
4
#include <grass/calc.h>
5
6
/****************************************************************
7
shiftru(a,b) = (unsigned) a >> b
8
****************************************************************/
9
10
int
f_shiftru
(
int
argc,
const
int
*argt,
void
**args)
11
{
12
CELL *res = args[0];
13
CELL *arg1 = args[1];
14
CELL *arg2 = args[2];
15
int
i;
16
17
if
(argc < 2)
18
return
E_ARG_LO;
19
if
(argc > 2)
20
return
E_ARG_HI;
21
22
if
(argt[1] != CELL_TYPE || argt[2] != CELL_TYPE)
23
return
E_ARG_TYPE;
24
25
if
(argt[0] != CELL_TYPE)
26
return
E_RES_TYPE;
27
28
for
(i = 0; i <
columns
; i++) {
29
if
(IS_NULL_C(&arg1[i]) || IS_NULL_C(&arg2[i]))
30
SET_NULL_C(&res[i]);
31
else
32
res[i] = ((
unsigned
int)arg1[i]) >> arg2[i];
33
}
34
35
return
0;
36
}
f_shiftru
int f_shiftru(int argc, const int *argt, void **args)
Definition:
xshiftru.c:10
columns
int columns
Definition:
calc.c:12
calc
xshiftru.c
Generated on Mon Apr 25 2022 14:03:04 for GRASS GIS 7 Programmer's Manual by
1.8.17