3 include __DIR__
."/_include.php";
12 function t_for_res($t1, $t2) {
15 $p = array_flip(array_keys($types));
17 if ($p[$t2] >= 8 ||
$p[$t1] >= 8) {
18 if ($p[$t2] > $p[$t1]) {
25 $s1 = substr($t1, $u1 ?
4 : 3);
27 $s2 = substr($t2, $u2 ?
4 : 3);
30 return "UINT".min(64,max($s1*2,$s2*2));
32 return "INT".min(64,max($s1*2,$s2*2));
37 function v_for_res($t1, $t2) {
40 return $types[t_for_res($t1, $t2)];
46 <?php
foreach ($ops as $op_name => $op) : ?
>
47 static inline token_t psi_calc_
<?
=$op_name?
>(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
50 switch (t1
) {<?php
/*nobr*/ ?
>
51 <?php
foreach ($types as $t1 => $v1) : ?
>
52 <?php
if (t_is_special($t1)) : ?
>
58 switch (t2
) {<?php
/*nobr*/ ?
>
59 <?php
foreach ($types as $t2 => $v2) : ?
>
60 <?php
if (t_is_special($t2)) :?
>
66 res
-><?
=v_for_res($t1, $t2)?
> = v1
-><?
=$v1?
> <?
=$op?
> v2
-><?
=$v2?
>;
67 return PSI_T_
<?
=t_for_res($t1, $t2)?
>;<?php
/*nobr*/ ?
>
68 <?php
if (t_is_special($t2)) : ?
>
78 break;<?php
/*nobr*/ ?
>
79 <?php
if (t_is_special($t1)) : ?
>
95 static inline token_t
psi_calc_mod(token_t t1
, impl_val
*v1
, token_t t2
, impl_val
*v2
, impl_val
*res
)
99 switch (t1
) {<?php
/*nobr*/ ?
>
100 <?php
foreach ($types as $t1 => $v1) : ?
>
101 <?php
if (t_is_special($t1)) :?
>
107 i1
.i64
= v1
-><?
=$v1?
>;
109 <?php
if (t_is_special($t1)) : ?
>
120 switch (t2
) {<?php
/*nobr*/ ?
>
121 <?php
foreach ($types as $t2 => $v2) : ?
>
122 <?php
if (t_is_special($t2)) :?
>
128 i2
.i64
= v2
-><?
=$v2?
>;
129 break;<?php
/*nobr*/ ?
>
130 <?php
if (t_is_special($t2)) : ?
>
141 res
->i64
= i1
.i64 % i2
.i64
;