File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 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)
14201420 if (str_seed -> len == 16 ) {
14211421 /* Endianness safe copy */
14221422 for (i = 0 ; i < 2 ; i ++ ) {
1423+ state -> s [i ] = 0 ;
14231424 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 );
14251426 }
14261427 }
14271428 } else {
@@ -1452,8 +1453,9 @@ PHP_METHOD(Random_Engine_Xoshiro256StarStar, __construct)
14521453 if (str_seed -> len == 32 ) {
14531454 /* Endianness safe copy */
14541455 for (i = 0 ; i < 4 ; i ++ ) {
1456+ state -> s [i ] = 0 ;
14551457 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 );
14571459 }
14581460 }
14591461 } else {
You can’t perform that action at this time.
0 commit comments