mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
random: Call int-seeding functions directly
As the `__construct()` implementation is engine-specific anyway, we know what engine were dealing with and can just call the seeding function directly instead of going through a function pointer. This likely improves construction performance a little, but I did not measure.
This commit is contained in:
committed by
Tim Düsterhus
parent
304c9c3db1
commit
f39357b07b
@@ -282,7 +282,7 @@ PHP_METHOD(Random_Engine_Mt19937, __construct)
|
||||
}
|
||||
}
|
||||
|
||||
engine->algo->seed(engine->status, seed);
|
||||
mt19937_seed_state(state, seed);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ PHP_METHOD(Random_Engine_PcgOneseq128XslRr64, __construct)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
} else {
|
||||
engine->algo->seed(engine->status, int_seed);
|
||||
seed128(state, php_random_uint128_constant(0ULL, (uint64_t) int_seed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ PHP_METHOD(Random_Engine_Xoshiro256StarStar, __construct)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
} else {
|
||||
engine->algo->seed(engine->status, (uint64_t) int_seed);
|
||||
seed64(state, (uint64_t) int_seed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user