Merge branch 'slimconfigure'
[m6w6/ext-psi] / src / calc / cast.h
index c6f14aa..eb93b3b 100644 (file)
@@ -57,6 +57,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i8 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i8 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i8 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i8 = in_val->fval;
                        break;
@@ -100,6 +106,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u8 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u8 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u8 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u8 = in_val->fval;
                        break;
@@ -143,6 +155,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i16 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i16 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i16 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i16 = in_val->fval;
                        break;
@@ -186,6 +204,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u16 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u16 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u16 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u16 = in_val->fval;
                        break;
@@ -229,6 +253,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i32 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i32 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i32 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i32 = in_val->fval;
                        break;
@@ -272,6 +302,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u32 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u32 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u32 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u32 = in_val->fval;
                        break;
@@ -315,6 +351,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i64 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i64 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i64 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i64 = in_val->fval;
                        break;
@@ -358,6 +400,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u64 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u64 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u64 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u64 = in_val->fval;
                        break;
@@ -370,6 +418,104 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (in_type) {
+               case PSI_T_INT8:
+                       out_val->i128 = in_val->i8;
+                       break;
+               case PSI_T_UINT8:
+                       out_val->i128 = in_val->u8;
+                       break;
+               case PSI_T_INT16:
+                       out_val->i128 = in_val->i16;
+                       break;
+               case PSI_T_UINT16:
+                       out_val->i128 = in_val->u16;
+                       break;
+               case PSI_T_INT32:
+                       out_val->i128 = in_val->i32;
+                       break;
+               case PSI_T_UINT32:
+                       out_val->i128 = in_val->u32;
+                       break;
+               case PSI_T_INT64:
+                       out_val->i128 = in_val->i64;
+                       break;
+               case PSI_T_UINT64:
+                       out_val->i128 = in_val->u64;
+                       break;
+               case PSI_T_INT128:
+                       out_val->i128 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i128 = in_val->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       out_val->i128 = in_val->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       out_val->i128 = in_val->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       out_val->i128 = in_val->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (in_type) {
+               case PSI_T_INT8:
+                       out_val->u128 = in_val->i8;
+                       break;
+               case PSI_T_UINT8:
+                       out_val->u128 = in_val->u8;
+                       break;
+               case PSI_T_INT16:
+                       out_val->u128 = in_val->i16;
+                       break;
+               case PSI_T_UINT16:
+                       out_val->u128 = in_val->u16;
+                       break;
+               case PSI_T_INT32:
+                       out_val->u128 = in_val->i32;
+                       break;
+               case PSI_T_UINT32:
+                       out_val->u128 = in_val->u32;
+                       break;
+               case PSI_T_INT64:
+                       out_val->u128 = in_val->i64;
+                       break;
+               case PSI_T_UINT64:
+                       out_val->u128 = in_val->u64;
+                       break;
+               case PSI_T_INT128:
+                       out_val->u128 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u128 = in_val->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       out_val->u128 = in_val->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       out_val->u128 = in_val->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       out_val->u128 = in_val->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
@@ -401,6 +547,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->fval = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->fval = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->fval = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->fval = in_val->fval;
                        break;
@@ -444,6 +596,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->dval = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->dval = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->dval = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->dval = in_val->fval;
                        break;
@@ -488,6 +646,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->ldval = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->ldval = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->ldval = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->ldval = in_val->fval;
                        break;