correct the type of the im_decode_exif() data parameter
[imager.git] / stackmach.c
CommitLineData
02d1d628
AMH
1#include "stackmach.h"
2
3double
b33c08f8 4i_op_run(int codes[], size_t code_size, double parms[], size_t parm_size) {
02d1d628
AMH
5 double stack[100];
6 double *sp = stack;
7
8 while (code_size) {
9 switch (*codes++) {
10 case bcAdd:
11 sp[-2] += sp[-1];
12 --sp;
13 break;
14
15 case bcSubtract:
16 sp[-2] -= sp[-1];
17 --sp;
18 break;
19
20 case bcDiv:
21 sp[-2] /= sp[-1];
22 --sp;
23 break;
24
25 case bcMult:
26 sp[-2] *= sp[-1];
27 --sp;
28 break;
29
30 case bcParm:
31 *sp++ = parms[*codes++];
32 --code_size;
33 break;
34
35 case bcSin:
36 sp[-1] = sin(sp[-1]);
37 break;
38
39 case bcCos:
40 sp[-1] = cos(sp[-1]);
41 break;
42
43 }
44 --code_size;
45 }
46
47 return sp[-1];
48}
49