ifdef HAVE_INT128
[m6w6/ext-psi] / src / calc / basic.h
index ec42112..04660b5 100644 (file)
@@ -58,12 +58,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 + v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i8 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i8 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i8 + v2->fval;
                        return PSI_T_FLOAT;
@@ -107,12 +113,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 + v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u8 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u8 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u8 + v2->fval;
                        return PSI_T_FLOAT;
@@ -156,12 +168,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 + v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i16 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i16 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i16 + v2->fval;
                        return PSI_T_FLOAT;
@@ -205,12 +223,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 + v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u16 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u16 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u16 + v2->fval;
                        return PSI_T_FLOAT;
@@ -254,12 +278,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 + v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i32 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i32 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i32 + v2->fval;
                        return PSI_T_FLOAT;
@@ -303,12 +333,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 + v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u32 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u32 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u32 + v2->fval;
                        return PSI_T_FLOAT;
@@ -352,12 +388,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 + v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i64 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i64 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i64 + v2->fval;
                        return PSI_T_FLOAT;
@@ -401,12 +443,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 + v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u64 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u64 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u64 + v2->fval;
                        return PSI_T_FLOAT;
@@ -424,6 +472,7 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#if HAVE_INT128
        case PSI_T_INT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -450,12 +499,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i128 = v1->i128 + v2->u64;
                        return PSI_T_INT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i128 + v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i128 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i128 + v2->fval;
                        return PSI_T_FLOAT;
@@ -473,6 +528,9 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
+#if HAVE_UINT128
        case PSI_T_UINT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -499,12 +557,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u128 = v1->u128 + v2->u64;
                        return PSI_T_UINT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->u128 = v1->u128 + v2->i128;
                        return PSI_T_UINT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u128 + v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u128 + v2->fval;
                        return PSI_T_FLOAT;
@@ -522,6 +586,8 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
        case PSI_T_FLOAT:
                switch (t2) {
                case PSI_T_INT8:
@@ -548,12 +614,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval + v2->u64;
                        return PSI_T_FLOAT;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->fval = v1->fval + v2->i128;
                        return PSI_T_FLOAT;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->fval = v1->fval + v2->u128;
                        return PSI_T_FLOAT;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->fval + v2->fval;
                        return PSI_T_FLOAT;
@@ -597,12 +669,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval + v2->u64;
                        return PSI_T_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->dval = v1->dval + v2->i128;
                        return PSI_T_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->dval = v1->dval + v2->u128;
                        return PSI_T_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->dval = v1->dval + v2->fval;
                        return PSI_T_DOUBLE;
@@ -647,12 +725,18 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval + v2->u64;
                        return PSI_T_LONG_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->ldval = v1->ldval + v2->i128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->ldval = v1->ldval + v2->u128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval + v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -709,12 +793,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 - v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i8 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i8 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i8 - v2->fval;
                        return PSI_T_FLOAT;
@@ -758,12 +848,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 - v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u8 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u8 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u8 - v2->fval;
                        return PSI_T_FLOAT;
@@ -807,12 +903,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 - v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i16 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i16 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i16 - v2->fval;
                        return PSI_T_FLOAT;
@@ -856,12 +958,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 - v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u16 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u16 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u16 - v2->fval;
                        return PSI_T_FLOAT;
@@ -905,12 +1013,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 - v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i32 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i32 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i32 - v2->fval;
                        return PSI_T_FLOAT;
@@ -954,12 +1068,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 - v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u32 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u32 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u32 - v2->fval;
                        return PSI_T_FLOAT;
@@ -1003,12 +1123,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 - v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i64 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i64 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i64 - v2->fval;
                        return PSI_T_FLOAT;
@@ -1052,12 +1178,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 - v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u64 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u64 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u64 - v2->fval;
                        return PSI_T_FLOAT;
@@ -1075,6 +1207,7 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#if HAVE_INT128
        case PSI_T_INT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -1101,12 +1234,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i128 = v1->i128 - v2->u64;
                        return PSI_T_INT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i128 - v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i128 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i128 - v2->fval;
                        return PSI_T_FLOAT;
@@ -1124,6 +1263,9 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
+#if HAVE_UINT128
        case PSI_T_UINT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -1150,12 +1292,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u128 = v1->u128 - v2->u64;
                        return PSI_T_UINT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->u128 = v1->u128 - v2->i128;
                        return PSI_T_UINT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u128 - v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u128 - v2->fval;
                        return PSI_T_FLOAT;
@@ -1173,6 +1321,8 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
        case PSI_T_FLOAT:
                switch (t2) {
                case PSI_T_INT8:
@@ -1199,12 +1349,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval - v2->u64;
                        return PSI_T_FLOAT;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->fval = v1->fval - v2->i128;
                        return PSI_T_FLOAT;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->fval = v1->fval - v2->u128;
                        return PSI_T_FLOAT;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->fval - v2->fval;
                        return PSI_T_FLOAT;
@@ -1248,12 +1404,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval - v2->u64;
                        return PSI_T_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->dval = v1->dval - v2->i128;
                        return PSI_T_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->dval = v1->dval - v2->u128;
                        return PSI_T_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->dval = v1->dval - v2->fval;
                        return PSI_T_DOUBLE;
@@ -1298,12 +1460,18 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval - v2->u64;
                        return PSI_T_LONG_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->ldval = v1->ldval - v2->i128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->ldval = v1->ldval - v2->u128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval - v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -1360,12 +1528,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 * v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i8 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i8 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i8 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1409,12 +1583,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 * v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u8 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u8 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u8 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1458,12 +1638,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 * v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i16 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i16 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i16 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1507,12 +1693,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 * v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u16 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u16 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u16 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1556,12 +1748,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 * v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i32 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i32 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i32 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1605,12 +1803,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 * v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u32 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u32 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u32 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1654,12 +1858,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 * v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i64 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i64 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i64 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1703,12 +1913,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 * v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u64 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u64 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u64 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1726,6 +1942,7 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#if HAVE_INT128
        case PSI_T_INT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -1752,12 +1969,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i128 = v1->i128 * v2->u64;
                        return PSI_T_INT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i128 * v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i128 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i128 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1775,6 +1998,9 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
+#if HAVE_UINT128
        case PSI_T_UINT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -1801,12 +2027,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u128 = v1->u128 * v2->u64;
                        return PSI_T_UINT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->u128 = v1->u128 * v2->i128;
                        return PSI_T_UINT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u128 * v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u128 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1824,6 +2056,8 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
        case PSI_T_FLOAT:
                switch (t2) {
                case PSI_T_INT8:
@@ -1850,12 +2084,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval * v2->u64;
                        return PSI_T_FLOAT;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->fval = v1->fval * v2->i128;
                        return PSI_T_FLOAT;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->fval = v1->fval * v2->u128;
                        return PSI_T_FLOAT;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->fval * v2->fval;
                        return PSI_T_FLOAT;
@@ -1899,12 +2139,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval * v2->u64;
                        return PSI_T_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->dval = v1->dval * v2->i128;
                        return PSI_T_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->dval = v1->dval * v2->u128;
                        return PSI_T_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->dval = v1->dval * v2->fval;
                        return PSI_T_DOUBLE;
@@ -1949,12 +2195,18 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval * v2->u64;
                        return PSI_T_LONG_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->ldval = v1->ldval * v2->i128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->ldval = v1->ldval * v2->u128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval * v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -2011,12 +2263,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 / v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i8 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i8 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i8 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2060,12 +2318,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 / v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u8 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u8 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u8 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2109,12 +2373,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 / v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i16 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i16 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i16 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2158,12 +2428,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 / v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u16 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u16 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u16 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2207,12 +2483,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 / v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i32 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i32 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i32 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2256,12 +2538,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 / v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u32 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u32 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u32 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2305,12 +2593,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 / v2->u64;
                        return PSI_T_INT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i64 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i64 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i64 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2354,12 +2648,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 / v2->u64;
                        return PSI_T_UINT64;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->u64 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u64 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u64 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2377,6 +2677,7 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#if HAVE_INT128
        case PSI_T_INT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -2403,12 +2704,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i128 = v1->i128 / v2->u64;
                        return PSI_T_INT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->i128 = v1->i128 / v2->i128;
                        return PSI_T_INT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->i128 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->i128 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2426,6 +2733,9 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
+#if HAVE_UINT128
        case PSI_T_UINT128:
                switch (t2) {
                case PSI_T_INT8:
@@ -2452,12 +2762,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u128 = v1->u128 / v2->u64;
                        return PSI_T_UINT128;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->u128 = v1->u128 / v2->i128;
                        return PSI_T_UINT128;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->u128 = v1->u128 / v2->u128;
                        return PSI_T_UINT128;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->u128 / v2->fval;
                        return PSI_T_FLOAT;
@@ -2475,6 +2791,8 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                        break;
                }
                break;
+#endif
+
        case PSI_T_FLOAT:
                switch (t2) {
                case PSI_T_INT8:
@@ -2501,12 +2819,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval / v2->u64;
                        return PSI_T_FLOAT;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->fval = v1->fval / v2->i128;
                        return PSI_T_FLOAT;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->fval = v1->fval / v2->u128;
                        return PSI_T_FLOAT;
+#      endif
+
                case PSI_T_FLOAT:
                        res->fval = v1->fval / v2->fval;
                        return PSI_T_FLOAT;
@@ -2550,12 +2874,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval / v2->u64;
                        return PSI_T_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->dval = v1->dval / v2->i128;
                        return PSI_T_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->dval = v1->dval / v2->u128;
                        return PSI_T_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->dval = v1->dval / v2->fval;
                        return PSI_T_DOUBLE;
@@ -2600,12 +2930,18 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval / v2->u64;
                        return PSI_T_LONG_DOUBLE;
+#      if HAVE_INT128
                case PSI_T_INT128:
                        res->ldval = v1->ldval / v2->i128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
+#      if HAVE_UINT128
                case PSI_T_UINT128:
                        res->ldval = v1->ldval / v2->u128;
                        return PSI_T_LONG_DOUBLE;
+#      endif
+
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval / v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -2671,14 +3007,20 @@ static inline token_t psi_calc_mod(token_t t1, impl_val *v1, token_t t2, impl_va
                i1.i64 = v1->u64;
                break;
 
+#if HAVE_INT128
        case PSI_T_INT128:
                i1.i64 = v1->i128;
                break;
 
+#endif
+
+#if HAVE_UINT128
        case PSI_T_UINT128:
                i1.i64 = v1->u128;
                break;
 
+#endif
+
        case PSI_T_FLOAT:
                i1.i64 = v1->fval;
                break;
@@ -2724,12 +3066,18 @@ static inline token_t psi_calc_mod(token_t t1, impl_val *v1, token_t t2, impl_va
        case PSI_T_UINT64:
                i2.i64 = v2->u64;
                break;
+#if HAVE_INT128
        case PSI_T_INT128:
                i2.i64 = v2->i128;
                break;
+#endif
+
+#if HAVE_UINT128
        case PSI_T_UINT128:
                i2.i64 = v2->u128;
                break;
+#endif
+
        case PSI_T_FLOAT:
                i2.i64 = v2->fval;
                break;