1--TEST-- 2GH-10403: Fix incorrect bitshifting and masking in ffi bitfield 3--EXTENSIONS-- 4ffi 5--SKIPIF-- 6<?php if (PHP_INT_SIZE != 8) echo "skip this test is for 64-bit only"; ?> 7--FILE-- 8<?php 9$ffi = FFI::cdef(<<<EOF 10 struct MyStruct { 11 uint64_t x : 10; 12 uint64_t y : 54; 13 }; 14EOF); 15 16$test_struct = $ffi->new('struct MyStruct'); 17$test_struct->x = 1023; 18$test_values = [0x3fafbfcfdfefff, 0x01020304050607, 0, 0x3fffffffffffff, 0x2ffffffffffff5]; 19foreach ($test_values as $test_value) { 20 $test_struct->y = $test_value; 21 var_dump($test_struct->y === $test_value); 22} 23var_dump($test_struct->x); 24?> 25--EXPECT-- 26bool(true) 27bool(true) 28bool(true) 29bool(true) 30bool(true) 31int(1023) 32