+static inline impl_val *psi_val_boolval(impl_val *tmp, token_t real_type, zend_bool boolval) {
+ switch (real_type) {
+ case PSI_T_INT8: tmp->i8 = boolval; break;
+ case PSI_T_UINT8: tmp->u8 = boolval; break;
+ case PSI_T_INT16: tmp->i16 = boolval; break;
+ case PSI_T_UINT16: tmp->u16 = boolval; break;
+ case PSI_T_INT32: tmp->i32 = boolval; break;
+ case PSI_T_UINT32: tmp->u32 = boolval; break;
+ case PSI_T_INT64: tmp->i64 = boolval; break;
+ case PSI_T_UINT64: tmp->u64 = boolval; break;
+ case PSI_T_FLOAT: tmp->fval = boolval; break;
+ case PSI_T_DOUBLE: tmp->dval = boolval; break;
+#ifdef HAVE_LONG_DOUBLE
+ case PSI_T_LONG_DOUBLE: tmp->ldval = boolval; break;
+#endif
+ EMPTY_SWITCH_DEFAULT_CASE();
+ }
+ return tmp;
+}
+
+impl_val *psi_let_boolval(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free)
+{
+ zend_bool boolval;
+ token_t real_type = type ? real_decl_type(type)->type : PSI_T_UINT8;
+
+ if (iarg->type->type == PSI_T_BOOL) {
+ boolval = iarg->val.zend.bval;
+ } else {
+ boolval = zend_is_true(iarg->_zv);
+ }
+
+ return psi_val_boolval(tmp, real_type, boolval);
+}
+
+# define RETVAL_LONG_U64(V) \
+ if (V > ZEND_LONG_MAX) { \
+ char d[24] = {0}; \
+ RETVAL_STRING(zend_print_ulong_to_buf(&d[22], V)); \
+ } else { \
+ RETVAL_LONG(V); \
+ }
+