mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02: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:
parent
304c9c3db1
commit
f39357b07b
3 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue