89524ee8abde5f2f21c7c846a6cade29b13b8214
[m6w6/ext-psi] / scripts / gen_cmp.php
1 <?php
2
3 $types = [
4 "FLOAT" => "fval",
5 "DOUBLE" => "dval",
6 "LONG_DOUBLE" => "ldval",
7 "INT8" => "i8",
8 "UINT8" => "u8",
9 "INT16" => "i16",
10 "UINT16" => "u16",
11 "INT32" => "i32",
12 "UINT32" => "u32",
13 "INT64" => "i64",
14 "UINT64" => "u64",
15 ];
16
17 printf("\tswitch (t1) { \\\n");
18 foreach ($types as $t1 => $f1) {
19 printf("\tcase PSI_T_%s: \\\n", $t1);
20 printf("\t\tswitch (t2) { \\\n");
21 foreach ($types as $t2 => $f2) {
22 printf("\t\tcase PSI_T_%s:\tPSI_CALC_OP2(u8, %s, %s);\tbreak; \\\n",
23 $t2, $f1, $f2);
24 }
25 printf("\t\tEMPTY_SWITCH_DEFAULT_CASE(); \\\n\t\t} \\\n\t\tbreak; \\\n");
26 }
27 printf("\tEMPTY_SWITCH_DEFAULT_CASE(); \\\n\t} \\\n");