Lines Matching refs:val
585 uint64_t val = 0; in zend_ffi_bit_field_read() local
597 val = (*p++ >> pos) & mask; in zend_ffi_bit_field_read()
603 val |= (uint64_t) *p++ << insert_pos; in zend_ffi_bit_field_read()
611 val |= (uint64_t) (*p & mask) << insert_pos; in zend_ffi_bit_field_read()
614 return val; in zend_ffi_bit_field_read()
620 uint64_t val = zend_ffi_bit_field_read(ptr, field); in zend_ffi_bit_field_to_zval() local
629 val = (int64_t)(val << shift) >> shift; in zend_ffi_bit_field_to_zval()
632 ZVAL_LONG(rv, val); in zend_ffi_bit_field_to_zval()
638 uint64_t val = zval_get_long(value); in zend_ffi_zval_to_bit_field() local
649 *p = (*p & ~mask) | ((val << pos) & mask); in zend_ffi_zval_to_bit_field()
657 *p = (*p & ~mask) | ((val << pos) & mask); in zend_ffi_zval_to_bit_field()
659 val >>= num_bits; in zend_ffi_zval_to_bit_field()
664 *p++ = val; in zend_ffi_zval_to_bit_field()
665 val >>= 8; in zend_ffi_zval_to_bit_field()
672 *p = (*p & ~mask) | (val & mask); in zend_ffi_zval_to_bit_field()
3022 while (Z_TYPE(b->val) == IS_UNDEF) { in zend_ffi_same_types()
3033 field = Z_PTR(b->val); in zend_ffi_same_types()
3056 while (Z_TYPE(b->val) == IS_UNDEF) { in zend_ffi_same_types()
3059 if (!zend_ffi_same_types(ZEND_FFI_TYPE(arg_type), ZEND_FFI_TYPE(Z_PTR(b->val)))) { in zend_ffi_same_types()
4091 zval *val; in ZEND_METHOD() local
4128 ZEND_HASH_REVERSE_FOREACH_VAL(dims, val) { in ZEND_METHOD()
4129 zend_long n = zval_get_long(val); in ZEND_METHOD()
5763 void zend_ffi_resolve_const(const char *name, size_t name_len, zend_ffi_val *val) /* {{{ */ argument
5768 val->kind = ZEND_FFI_VAL_NAME;
5769 val->str = name;
5770 val->len = name_len;
5775 val->i64 = sym->value;
5780 val->kind = ZEND_FFI_VAL_INT32;
5783 val->kind = ZEND_FFI_VAL_INT64;
5788 val->kind = ZEND_FFI_VAL_UINT32;
5791 val->kind = ZEND_FFI_VAL_UINT64;
5799 val->kind = ZEND_FFI_VAL_ERROR;
5823 …l(zend_ffi_dcl *enum_dcl, const char *name, size_t name_len, zend_ffi_val *val, int64_t *min, int6… argument
5837 if (val->kind == ZEND_FFI_VAL_EMPTY) {
5849 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
5850 if (!is_signed && val->ch < 0) {
5857 value = val->ch;
5858 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
5859 if (!is_signed && val->i64 < 0) {
5866 value = val->i64;
5867 } else if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
5868 if (is_signed && val->u64 > 0x7FFFFFFFFFFFFFFFULL) {
5871 value = val->u64;
6772 …ute_value(zend_ffi_dcl *dcl, const char *name, size_t name_len, int n, zend_ffi_val *val) /* {{{ */ argument
6805 …&& (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_V…
6806 && val->i64 == 3) {
6814 …&& (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_V…
6815 && val->i64 > 0 && val->i64 <= 0x80000000 && (val->i64 & (val->i64 - 1)) == 0) {
6816 dcl->align = val->i64;
6823 && (val->kind == ZEND_FFI_VAL_NAME)) {
6824 const char *str = val->str;
6825 size_t len = val->len;
6887 …_attribute_value(zend_ffi_dcl *dcl, const char *name, size_t name_len, zend_ffi_val *val) /* {{{ */ argument
6890 …if ((val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_…
6891 && val->i64 > 0 && val->i64 <= 0x80000000 && (val->i64 & (val->i64 - 1)) == 0) {
6892 dcl->align = val->i64;
7001 #define zend_ffi_expr_bool(val) do { \ argument
7002 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) { \
7003 val->kind = ZEND_FFI_VAL_INT32; \
7004 val->i64 = !!val->u64; \
7005 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) { \
7006 val->kind = ZEND_FFI_VAL_INT32; \
7007 val->i64 = !!val->i64; \
7008 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7009 val->kind = ZEND_FFI_VAL_INT32; \
7010 val->i64 = !!val->d; \
7011 } else if (val->kind == ZEND_FFI_VAL_CHAR) { \
7012 val->kind = ZEND_FFI_VAL_INT32; \
7013 val->i64 = !!val->ch; \
7015 val->kind = ZEND_FFI_VAL_ERROR; \
7019 #define zend_ffi_expr_math(val, op2, OP) do { \ argument
7020 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) { \
7022 val->kind = MAX(val->kind, op2->kind); \
7023 val->u64 = val->u64 OP op2->u64; \
7025 val->u64 = val->u64 OP op2->i64; \
7027 val->u64 = val->u64 OP op2->i64; \
7029 val->kind = op2->kind; \
7030 val->d = (zend_ffi_double)val->u64 OP op2->d; \
7032 val->u64 = val->u64 OP op2->ch; \
7034 val->kind = ZEND_FFI_VAL_ERROR; \
7036 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) { \
7038 val->i64 = val->i64 OP op2->u64; \
7040 val->i64 = val->i64 OP op2->u64; \
7042 val->kind = MAX(val->kind, op2->kind); \
7043 val->i64 = val->i64 OP op2->i64; \
7045 val->kind = op2->kind; \
7046 val->d = (zend_ffi_double)val->i64 OP op2->d; \
7048 val->i64 = val->i64 OP op2->ch; \
7050 val->kind = ZEND_FFI_VAL_ERROR; \
7052 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7054 val->d = val->d OP (zend_ffi_double)op2->u64; \
7056 val->d = val->d OP (zend_ffi_double)op2->i64; \
7058 val->kind = MAX(val->kind, op2->kind); \
7059 val->d = val->d OP op2->d; \
7061 val->d = val->d OP (zend_ffi_double)op2->ch; \
7063 val->kind = ZEND_FFI_VAL_ERROR; \
7065 } else if (val->kind == ZEND_FFI_VAL_CHAR) { \
7067 val->kind = op2->kind; \
7068 val->u64 = val->ch OP op2->u64; \
7070 val->kind = ZEND_FFI_VAL_INT64; \
7071 val->i64 = val->ch OP op2->i64; \
7073 val->kind = op2->kind; \
7074 val->d = (zend_ffi_double)val->ch OP op2->d; \
7076 val->ch = val->ch OP op2->ch; \
7078 val->kind = ZEND_FFI_VAL_ERROR; \
7081 val->kind = ZEND_FFI_VAL_ERROR; \
7085 #define zend_ffi_expr_int_math(val, op2, OP) do { \ argument
7086 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) { \
7088 val->kind = MAX(val->kind, op2->kind); \
7089 val->u64 = val->u64 OP op2->u64; \
7091 val->u64 = val->u64 OP op2->i64; \
7093 val->u64 = val->u64 OP op2->i64; \
7095 val->u64 = val->u64 OP (uint64_t)op2->d; \
7097 val->u64 = val->u64 OP op2->ch; \
7099 val->kind = ZEND_FFI_VAL_ERROR; \
7101 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) { \
7103 val->i64 = val->i64 OP op2->u64; \
7105 val->i64 = val->i64 OP op2->u64; \
7107 val->kind = MAX(val->kind, op2->kind); \
7108 val->i64 = val->i64 OP op2->i64; \
7110 val->u64 = val->u64 OP (int64_t)op2->d; \
7112 val->i64 = val->i64 OP op2->ch; \
7114 val->kind = ZEND_FFI_VAL_ERROR; \
7116 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7118 val->kind = op2->kind; \
7119 val->u64 = (uint64_t)val->d OP op2->u64; \
7121 val->kind = op2->kind; \
7122 val->i64 = (int64_t)val->d OP op2->i64; \
7124 val->kind = ZEND_FFI_VAL_ERROR; \
7126 } else if (val->kind == ZEND_FFI_VAL_CHAR) { \
7128 val->kind = op2->kind; \
7129 val->u64 = (uint64_t)val->ch OP op2->u64; \
7131 val->kind = op2->kind; \
7132 val->i64 = (int64_t)val->ch OP op2->u64; \
7134 val->ch = val->ch OP op2->ch; \
7136 val->kind = ZEND_FFI_VAL_ERROR; \
7139 val->kind = ZEND_FFI_VAL_ERROR; \
7143 #define zend_ffi_expr_cmp(val, op2, OP) do { \ argument
7144 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) { \
7146 val->kind = ZEND_FFI_VAL_INT32; \
7147 val->i64 = val->u64 OP op2->u64; \
7149 val->kind = ZEND_FFI_VAL_INT32; \
7150 val->i64 = val->u64 OP op2->u64; /*signed/unsigned */ \
7152 val->kind = ZEND_FFI_VAL_INT32; \
7153 val->i64 = (zend_ffi_double)val->u64 OP op2->d; \
7155 val->kind = ZEND_FFI_VAL_INT32; \
7156 val->i64 = val->u64 OP op2->d; \
7158 val->kind = ZEND_FFI_VAL_ERROR; \
7160 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) { \
7162 val->kind = ZEND_FFI_VAL_INT32; \
7163 val->i64 = val->i64 OP op2->i64; /* signed/unsigned */ \
7165 val->kind = ZEND_FFI_VAL_INT32; \
7166 val->i64 = val->i64 OP op2->i64; \
7168 val->kind = ZEND_FFI_VAL_INT32; \
7169 val->i64 = (zend_ffi_double)val->i64 OP op2->d; \
7171 val->kind = ZEND_FFI_VAL_INT32; \
7172 val->i64 = val->i64 OP op2->ch; \
7174 val->kind = ZEND_FFI_VAL_ERROR; \
7176 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7178 val->kind = ZEND_FFI_VAL_INT32; \
7179 val->i64 = val->d OP (zend_ffi_double)op2->u64; \
7181 val->kind = ZEND_FFI_VAL_INT32; \
7182 val->i64 = val->d OP (zend_ffi_double)op2->i64; \
7184 val->kind = ZEND_FFI_VAL_INT32; \
7185 val->i64 = val->d OP op2->d; \
7187 val->kind = ZEND_FFI_VAL_INT32; \
7188 val->i64 = val->d OP (zend_ffi_double)op2->ch; \
7190 val->kind = ZEND_FFI_VAL_ERROR; \
7192 } else if (val->kind == ZEND_FFI_VAL_CHAR) { \
7194 val->kind = ZEND_FFI_VAL_INT32; \
7195 val->i64 = val->ch OP op2->i64; /* signed/unsigned */ \
7197 val->kind = ZEND_FFI_VAL_INT32; \
7198 val->i64 = val->ch OP op2->i64; \
7200 val->kind = ZEND_FFI_VAL_INT32; \
7201 val->i64 = (zend_ffi_double)val->ch OP op2->d; \
7203 val->kind = ZEND_FFI_VAL_INT32; \
7204 val->i64 = val->ch OP op2->ch; \
7206 val->kind = ZEND_FFI_VAL_ERROR; \
7209 val->kind = ZEND_FFI_VAL_ERROR; \
7213 void zend_ffi_expr_conditional(zend_ffi_val *val, zend_ffi_val *op2, zend_ffi_val *op3) /* {{{ */ argument
7215 zend_ffi_expr_bool(val);
7216 if (val->kind == ZEND_FFI_VAL_INT32) {
7217 if (val->i64) {
7218 *val = *op2;
7220 *val = *op3;
7226 void zend_ffi_expr_bool_or(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7228 zend_ffi_expr_bool(val);
7230 if (val->kind == ZEND_FFI_VAL_INT32 && op2->kind == ZEND_FFI_VAL_INT32) {
7231 val->i64 = val->i64 || op2->i64;
7233 val->kind = ZEND_FFI_VAL_ERROR;
7238 void zend_ffi_expr_bool_and(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7240 zend_ffi_expr_bool(val);
7242 if (val->kind == ZEND_FFI_VAL_INT32 && op2->kind == ZEND_FFI_VAL_INT32) {
7243 val->i64 = val->i64 && op2->i64;
7245 val->kind = ZEND_FFI_VAL_ERROR;
7250 void zend_ffi_expr_bw_or(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7252 zend_ffi_expr_int_math(val, op2, |);
7256 void zend_ffi_expr_bw_xor(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7258 zend_ffi_expr_int_math(val, op2, ^);
7262 void zend_ffi_expr_bw_and(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7264 zend_ffi_expr_int_math(val, op2, &);
7268 void zend_ffi_expr_is_equal(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7270 zend_ffi_expr_cmp(val, op2, ==);
7274 void zend_ffi_expr_is_not_equal(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7276 zend_ffi_expr_cmp(val, op2, !=);
7280 void zend_ffi_expr_is_less(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7282 zend_ffi_expr_cmp(val, op2, <);
7286 void zend_ffi_expr_is_greater(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7288 zend_ffi_expr_cmp(val, op2, >);
7292 void zend_ffi_expr_is_less_or_equal(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7294 zend_ffi_expr_cmp(val, op2, <=);
7298 void zend_ffi_expr_is_greater_or_equal(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7300 zend_ffi_expr_cmp(val, op2, >=);
7304 void zend_ffi_expr_shift_left(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7306 zend_ffi_expr_int_math(val, op2, <<);
7310 void zend_ffi_expr_shift_right(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7312 zend_ffi_expr_int_math(val, op2, >>);
7316 void zend_ffi_expr_add(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7318 zend_ffi_expr_math(val, op2, +);
7322 void zend_ffi_expr_sub(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7324 zend_ffi_expr_math(val, op2, -);
7328 void zend_ffi_expr_mul(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7330 zend_ffi_expr_math(val, op2, *);
7334 void zend_ffi_expr_div(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7336 zend_ffi_expr_math(val, op2, /);
7340 void zend_ffi_expr_mod(zend_ffi_val *val, zend_ffi_val *op2) /* {{{ */ argument
7342 zend_ffi_expr_int_math(val, op2, %); // ???
7346 void zend_ffi_expr_cast(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */ argument
7351 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7352 val->kind = ZEND_FFI_VAL_FLOAT;
7353 val->d = val->u64;
7354 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7355 val->kind = ZEND_FFI_VAL_FLOAT;
7356 val->d = val->i64;
7357 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7358 val->kind = ZEND_FFI_VAL_FLOAT;
7359 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7360 val->kind = ZEND_FFI_VAL_FLOAT;
7361 val->d = val->ch;
7363 val->kind = ZEND_FFI_VAL_ERROR;
7367 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7368 val->kind = ZEND_FFI_VAL_DOUBLE;
7369 val->d = val->u64;
7370 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7371 val->kind = ZEND_FFI_VAL_DOUBLE;
7372 val->d = val->i64;
7373 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7374 val->kind = ZEND_FFI_VAL_DOUBLE;
7375 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7376 val->kind = ZEND_FFI_VAL_DOUBLE;
7377 val->d = val->ch;
7379 val->kind = ZEND_FFI_VAL_ERROR;
7384 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7385 val->kind = ZEND_FFI_VAL_LONG_DOUBLE;
7386 val->d = val->u64;
7387 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7388 val->kind = ZEND_FFI_VAL_LONG_DOUBLE;
7389 val->d = val->i64;
7390 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7391 val->kind = ZEND_FFI_VAL_LONG_DOUBLE;
7392 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7393 val->kind = ZEND_FFI_VAL_LONG_DOUBLE;
7394 val->d = val->ch;
7396 val->kind = ZEND_FFI_VAL_ERROR;
7404 …if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64 || val->kind == ZEND_FFI_…
7405 val->kind = ZEND_FFI_VAL_UINT32;
7406 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7407 val->kind = ZEND_FFI_VAL_UINT32;
7408 val->u64 = val->d;
7409 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7410 val->kind = ZEND_FFI_VAL_UINT32;
7411 val->u64 = val->ch;
7413 val->kind = ZEND_FFI_VAL_ERROR;
7419 …if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64 || val->kind == ZEND_FFI_…
7420 val->kind = ZEND_FFI_VAL_INT32;
7421 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7422 val->kind = ZEND_FFI_VAL_INT32;
7423 val->i64 = val->d;
7424 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7425 val->kind = ZEND_FFI_VAL_INT32;
7426 val->i64 = val->ch;
7428 val->kind = ZEND_FFI_VAL_ERROR;
7432 …if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64 || val->kind == ZEND_FFI_…
7433 val->kind = ZEND_FFI_VAL_UINT64;
7434 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7435 val->kind = ZEND_FFI_VAL_UINT64;
7436 val->u64 = val->d;
7437 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7438 val->kind = ZEND_FFI_VAL_UINT64;
7439 val->u64 = val->ch;
7441 val->kind = ZEND_FFI_VAL_ERROR;
7445 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7446 val->kind = ZEND_FFI_VAL_CHAR;
7447 val->ch = val->u64;
7448 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7449 val->kind = ZEND_FFI_VAL_CHAR;
7450 val->ch = val->i64;
7451 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7452 val->kind = ZEND_FFI_VAL_CHAR;
7453 val->ch = val->d;
7454 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7456 val->kind = ZEND_FFI_VAL_ERROR;
7460 …if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64 || val->kind == ZEND_FFI_…
7461 val->kind = ZEND_FFI_VAL_UINT32;
7462 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7463 val->kind = ZEND_FFI_VAL_UINT32;
7464 val->u64 = val->d;
7465 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7466 val->kind = ZEND_FFI_VAL_UINT32;
7467 val->u64 = val->ch;
7469 val->kind = ZEND_FFI_VAL_ERROR;
7473 val->kind = ZEND_FFI_VAL_ERROR;
7480 void zend_ffi_expr_plus(zend_ffi_val *val) /* {{{ */ argument
7482 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7483 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7484 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7485 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7487 val->kind = ZEND_FFI_VAL_ERROR;
7492 void zend_ffi_expr_neg(zend_ffi_val *val) /* {{{ */ argument
7494 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7495 val->u64 = -val->u64;
7496 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7497 val->i64 = -val->i64;
7498 …} else if (val->kind == ZEND_FFI_VAL_FLOAT || val->kind == ZEND_FFI_VAL_DOUBLE || val->kind == ZEN…
7499 val->d = -val->d;
7500 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7501 val->ch = -val->ch;
7503 val->kind = ZEND_FFI_VAL_ERROR;
7508 void zend_ffi_expr_bw_not(zend_ffi_val *val) /* {{{ */ argument
7510 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_UINT64) {
7511 val->u64 = ~val->u64;
7512 } else if (val->kind == ZEND_FFI_VAL_INT32 || val->kind == ZEND_FFI_VAL_INT64) {
7513 val->i64 = ~val->i64;
7514 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7515 val->ch = ~val->ch;
7517 val->kind = ZEND_FFI_VAL_ERROR;
7522 void zend_ffi_expr_bool_not(zend_ffi_val *val) /* {{{ */ argument
7524 zend_ffi_expr_bool(val);
7525 if (val->kind == ZEND_FFI_VAL_INT32) {
7526 val->i64 = !val->i64;
7531 void zend_ffi_expr_sizeof_val(zend_ffi_val *val) /* {{{ */ argument
7533 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_INT32) {
7534 val->kind = ZEND_FFI_VAL_UINT32;
7535 val->u64 = zend_ffi_type_uint32.size;
7536 } else if (val->kind == ZEND_FFI_VAL_UINT64 || val->kind == ZEND_FFI_VAL_INT64) {
7537 val->kind = ZEND_FFI_VAL_UINT32;
7538 val->u64 = zend_ffi_type_uint64.size;
7539 } else if (val->kind == ZEND_FFI_VAL_FLOAT) {
7540 val->kind = ZEND_FFI_VAL_UINT32;
7541 val->u64 = zend_ffi_type_float.size;
7542 } else if (val->kind == ZEND_FFI_VAL_DOUBLE) {
7543 val->kind = ZEND_FFI_VAL_UINT32;
7544 val->u64 = zend_ffi_type_double.size;
7545 } else if (val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
7546 val->kind = ZEND_FFI_VAL_UINT32;
7548 val->u64 = zend_ffi_type_double.size;
7550 val->u64 = zend_ffi_type_long_double.size;
7552 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7553 val->kind = ZEND_FFI_VAL_UINT32;
7554 val->u64 = zend_ffi_type_char.size;
7555 } else if (val->kind == ZEND_FFI_VAL_STRING) {
7556 if (memchr(val->str, '\\', val->len)) {
7558 val->kind = ZEND_FFI_VAL_ERROR;
7560 val->kind = ZEND_FFI_VAL_UINT32;
7561 val->u64 = val->len + 1;
7564 val->kind = ZEND_FFI_VAL_ERROR;
7569 void zend_ffi_expr_sizeof_type(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */ argument
7575 val->kind = (type->size > 0xffffffff) ? ZEND_FFI_VAL_UINT64 : ZEND_FFI_VAL_UINT32;
7576 val->u64 = type->size;
7581 void zend_ffi_expr_alignof_val(zend_ffi_val *val) /* {{{ */ argument
7583 if (val->kind == ZEND_FFI_VAL_UINT32 || val->kind == ZEND_FFI_VAL_INT32) {
7584 val->kind = ZEND_FFI_VAL_UINT32;
7585 val->u64 = zend_ffi_type_uint32.align;
7586 } else if (val->kind == ZEND_FFI_VAL_UINT64 || val->kind == ZEND_FFI_VAL_INT64) {
7587 val->kind = ZEND_FFI_VAL_UINT32;
7588 val->u64 = zend_ffi_type_uint64.align;
7589 } else if (val->kind == ZEND_FFI_VAL_FLOAT) {
7590 val->kind = ZEND_FFI_VAL_UINT32;
7591 val->u64 = zend_ffi_type_float.align;
7592 } else if (val->kind == ZEND_FFI_VAL_DOUBLE) {
7593 val->kind = ZEND_FFI_VAL_UINT32;
7594 val->u64 = zend_ffi_type_double.align;
7596 } else if (val->kind == ZEND_FFI_VAL_LONG_DOUBLE) {
7597 val->kind = ZEND_FFI_VAL_UINT32;
7598 val->u64 = zend_ffi_type_long_double.align;
7600 } else if (val->kind == ZEND_FFI_VAL_CHAR) {
7601 val->kind = ZEND_FFI_VAL_UINT32;
7602 val->u64 = zend_ffi_type_char.size;
7603 } else if (val->kind == ZEND_FFI_VAL_STRING) {
7604 val->kind = ZEND_FFI_VAL_UINT32;
7605 val->u64 = _Alignof(char*);
7607 val->kind = ZEND_FFI_VAL_ERROR;
7612 void zend_ffi_expr_alignof_type(zend_ffi_val *val, zend_ffi_dcl *dcl) /* {{{ */ argument
7615 val->kind = ZEND_FFI_VAL_UINT32;
7616 val->u64 = ZEND_FFI_TYPE(dcl->type)->align;
7621 void zend_ffi_val_number(zend_ffi_val *val, int base, const char *str, size_t str_len) /* {{{ */ argument
7646 val->u64 = strtoull(str, NULL, base);
7648 val->kind = ZEND_FFI_VAL_UINT32;
7650 val->kind = (sizeof(long) == 4) ? ZEND_FFI_VAL_UINT32 : ZEND_FFI_VAL_UINT64;
7652 val->kind = ZEND_FFI_VAL_UINT64;
7655 val->i64 = strtoll(str, NULL, base);
7657 val->kind = ZEND_FFI_VAL_INT32;
7659 val->kind = (sizeof(long) == 4) ? ZEND_FFI_VAL_INT32 : ZEND_FFI_VAL_INT64;
7661 val->kind = ZEND_FFI_VAL_INT64;
7667 void zend_ffi_val_float_number(zend_ffi_val *val, const char *str, size_t str_len) /* {{{ */ argument
7669 val->d = strtold(str, NULL);
7671 val->kind = ZEND_FFI_VAL_FLOAT;
7673 val->kind = ZEND_FFI_VAL_LONG_DOUBLE;
7675 val->kind = ZEND_FFI_VAL_DOUBLE;
7680 void zend_ffi_val_string(zend_ffi_val *val, const char *str, size_t str_len) /* {{{ */ argument
7683 val->kind = ZEND_FFI_VAL_ERROR;
7685 val->kind = ZEND_FFI_VAL_STRING;
7686 val->str = str + 1;
7687 val->len = str_len - 2;
7692 void zend_ffi_val_character(zend_ffi_val *val, const char *str, size_t str_len) /* {{{ */ argument
7697 val->kind = ZEND_FFI_VAL_ERROR;
7699 val->kind = ZEND_FFI_VAL_CHAR;
7701 val->ch = str[1];
7705 val->ch = '\b';
7707 val->ch = '\f';
7709 val->ch = '\n';
7711 val->ch = '\r';
7713 val->ch = '\t';
7715 val->ch = '\v';
7723 val->kind = ZEND_FFI_VAL_ERROR;
7726 val->kind = ZEND_FFI_VAL_ERROR;
7729 val->ch = n;
7731 val->kind = ZEND_FFI_VAL_ERROR;
7741 val->kind = ZEND_FFI_VAL_ERROR;
7751 val->kind = ZEND_FFI_VAL_ERROR;
7754 val->ch = n;
7756 val->ch = str[2];
7758 val->kind = ZEND_FFI_VAL_ERROR;
7761 val->kind = ZEND_FFI_VAL_ERROR;