File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1420,8 +1420,9 @@ PHP_METHOD(Random_Engine_XorShift128Plus, __construct)
1420
1420
if (str_seed -> len == 16 ) {
1421
1421
/* Endianness safe copy */
1422
1422
for (i = 0 ; i < 2 ; i ++ ) {
1423
+ state -> s [i ] = 0 ;
1423
1424
for (j = 0 ; j < 8 ; j ++ ) {
1424
- state -> s [i ] += (unsigned char ) ZSTR_VAL (str_seed )[(i * j ) + j ] >> (j * 8 );
1425
+ state -> s [i ] += (( uint64_t ) ( unsigned char ) ZSTR_VAL (str_seed )[(i * 8 ) + j ]) << (j * 8 );
1425
1426
}
1426
1427
}
1427
1428
} else {
@@ -1452,8 +1453,9 @@ PHP_METHOD(Random_Engine_Xoshiro256StarStar, __construct)
1452
1453
if (str_seed -> len == 32 ) {
1453
1454
/* Endianness safe copy */
1454
1455
for (i = 0 ; i < 4 ; i ++ ) {
1456
+ state -> s [i ] = 0 ;
1455
1457
for (j = 0 ; j < 8 ; j ++ ) {
1456
- state -> s [i ] += (unsigned char ) ZSTR_VAL (str_seed )[(i * j ) + j ] >> (j * 8 );
1458
+ state -> s [i ] += (( uint64_t ) ( unsigned char ) ZSTR_VAL (str_seed )[(i * 8 ) + j ]) << (j * 8 );
1457
1459
}
1458
1460
}
1459
1461
} else {
You can’t perform that action at this time.
0 commit comments