Kernel: Improve random number generation for unsigned types

This commit is contained in:
Bananymous 2024-05-29 20:00:47 +03:00
parent 076f1efecb
commit a1b3490764
1 changed files with 4 additions and 6 deletions

View File

@ -11,14 +11,12 @@ namespace Kernel
static void initialize();
static uint32_t get_u32();
static uint64_t get_u64();
template<typename T>
static T get();
template<BAN::unsigned_integral T> requires (sizeof(T) == 4)
static T get() { return Random::get_u32(); }
template<BAN::unsigned_integral T> requires (sizeof(T) == 8)
static T get() { return Random::get_u64(); }
};
template<>
inline uint32_t Random::get<uint32_t>() { return Random::get_u32(); }
template<>
inline uint64_t Random::get<uint64_t>() { return Random::get_u64(); }
}