set psi as module for register functions
[m6w6/ext-psi] / scripts / gen_calc_unary.php
1 <?php
2 include __DIR__."/_include.php"
3 ?>
4
5 static inline token_t psi_calc_minus(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
6 {
7 (void) t2;
8 (void) v2;
9
10 switch (t1) {<?php /*nobr */ ?>
11 <?php foreach ($types as $t1 => $v1) : ?>
12 <?php if (t_is_special($t1)) :?>
13
14 #if HAVE_<?=$t1?>
15 <?php endif; ?>
16
17 case PSI_T_<?=$t1?>:
18 res-><?=$v1?> = -v1-><?=$v1?>;
19 break;<?php /*nobr */ ?>
20 <?php if (t_is_special($t1)) : ?>
21
22 #endif
23 <?php endif; ?>
24 <?php endforeach; ?>
25
26 default:
27 assert(0);
28 break;
29 }
30 return t1;
31 }
32
33
34 static inline token_t psi_calc_bool_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
35 {
36 (void) t2;
37 (void) v2;
38
39 switch (t1) {<?php /*nobr */ ?>
40 <?php foreach ($types as $t1 => $v1) : ?>
41 <?php if (t_is_special($t1)) :?>
42
43 #if HAVE_<?=$t1?>
44 <?php endif; ?>
45
46 case PSI_T_<?=$t1?>:
47 res->u8 = !v1-><?=$v1?>;
48 break;<?php /*nobr */ ?>
49 <?php if (t_is_special($t1)) : ?>
50
51 #endif
52 <?php endif; ?>
53 <?php endforeach; ?>
54
55 default:
56 assert(0);
57 break;
58 }
59 return PSI_T_UINT8;
60 }
61
62
63 static inline token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
64 {
65 impl_val i1;
66
67 (void) t2;
68 (void) v2;
69
70 switch (t1) {<?php /*nobr*/ ?>
71 <?php foreach ($types as $t1 => $v1) : ?>
72 <?php if (t_is_special($t1)) :?>
73
74 #if HAVE_<?=$t1?>
75 <?php endif; ?>
76
77 case PSI_T_<?=$t1?>:
78 i1.u64 = v1-><?=$v1?>;
79 break;
80 <?php if (t_is_special($t1)) : ?>
81
82 #endif
83 <?php endif; ?>
84 <?php endforeach; ?>
85
86 default:
87 assert(0);
88 break;
89 }
90
91 res->u64 = ~i1.u64;
92 return PSI_T_UINT64;
93 }