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:
Tim Düsterhus 2024-01-29 17:00:11 +01:00 committed by Tim Düsterhus
parent 304c9c3db1
commit f39357b07b
3 changed files with 3 additions and 3 deletions

View file

@ -282,7 +282,7 @@ PHP_METHOD(Random_Engine_Mt19937, __construct)
}
}
engine->algo->seed(engine->status, seed);
mt19937_seed_state(state, seed);
}
/* }}} */

View file

@ -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));
}
}
}

View file

@ -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);
}
}
}