GRASS GIS 8 Programmer's Manual 8.2.1RC1(2022)-exported
xshiftl.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/****************************************************************
7shiftl(a,b) = a << b
8****************************************************************/
9
10int f_shiftl(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] = arg1[i] << arg2[i];
33 }
34
35 return 0;
36}
int columns
Definition: calc.c:12
int f_shiftl(int argc, const int *argt, void **args)
Definition: xshiftl.c:10