Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/prng.h
- This file was added.
/*- | |||||
* This file is in the public domain. | |||||
* | |||||
* $FreeBSD$ | |||||
*/ | |||||
#ifndef _SYS_PRNG_H_ | |||||
#define _SYS_PRNG_H_ | |||||
kib: Please use include guards instead of non-standard pragma. | |||||
Done Inline ActionsWe don't usually use these. Please use macro-based include guards instead. markm: We don't usually use these. Please use macro-based include guards instead. | |||||
Done Inline ActionsFine, if y'all insist :-). cem: Fine, if y'all insist :-). | |||||
#define PCG_USE_INLINE_ASM 1 | |||||
#include <contrib/pcg-c/include/pcg_variants.h> | |||||
#ifdef _KERNEL | |||||
__uint32_t prng32(void); | |||||
__uint32_t prng32_bounded(__uint32_t bound); | |||||
__uint64_t prng64(void); | |||||
Done Inline ActionsThese should probably be #ifdef _KERNEL to allow userspace inclusion of PCG via sys/prng.h. This might be useful for utilities in base that use random(3) or rand(3) today. cem: These should probably be `#ifdef _KERNEL` to allow userspace inclusion of PCG via `sys/prng.h`. | |||||
Not Done Inline ActionsI do not think userspace would work because we do not install /usr/include/contrib/... . But braces cannot hurt anyway. kib: I do not think userspace would work because we do not install /usr/include/contrib/... . But… | |||||
__uint64_t prng64_bounded(__uint64_t bound); | |||||
#endif | |||||
#endif |
Please use include guards instead of non-standard pragma.