You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1010 B
59 lines
1010 B
// C api for rngxx
|
|
#ifndef _RNGXX_H
|
|
#define _RNGXX_H
|
|
|
|
#ifndef _RNGXX_IMPL
|
|
#define _RNGXX_COMMON_MINIMAL
|
|
#endif
|
|
#include "rngxx/internal/common.h"
|
|
#ifndef _RNGXX_IMPL
|
|
#undef _RNGXX_COMMON_MINIMAL
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
#ifndef _RNGXX_IMPL_ONLY_TYPES
|
|
#warning "C++ compilers might not like this header file. Please use the C++ interface for C++ TUs"
|
|
#endif
|
|
extern "C" {
|
|
#endif
|
|
|
|
// -- C API types -- (C++ compat)
|
|
typedef struct Random rng_t;
|
|
|
|
enum rng_kind {
|
|
RNG_KIND_CRAND,
|
|
};
|
|
|
|
enum rng_next_flag {
|
|
RNG_TYQ_SIGNED = 0, // Binary with `unsigned`.
|
|
RNG_TYQ_UNSIGNED = 1 << 0,
|
|
|
|
RNG_TYQ_CHAOS = 1 << 1,
|
|
}; // 2 bits
|
|
|
|
enum rng_next_type {
|
|
RNG_TY_BLOB = 0,
|
|
|
|
RNG_TY_INT8,
|
|
RNG_TY_INT16,
|
|
RNG_TY_INT32,
|
|
RNG_TY_INT64,
|
|
|
|
RNG_TY_F32,
|
|
RNG_TY_F64,
|
|
}; // 4 bits
|
|
|
|
// -- // --
|
|
#ifndef _RNGXX_IMPL_ONLY_TYPES
|
|
// -- C API functions -- (C++ NO compat)
|
|
rng_t* rng_new(enum rng_kind kind, u64 seed[static restrict 1]);
|
|
void rng_free(rng_t* rng);
|
|
|
|
// -- // --
|
|
#endif
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _RNGXX_H */
|