Started implementing next for arrays.

Major version bump: `struct rng_next_opt` ABI break.

Fortune for rngxx's current commit: Middle blessing − 中吉
iter
Avril 3 years ago
parent 1cf5ca05b2
commit 5a4b68ab3f
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -3,8 +3,8 @@
PROJECT=rngxx PROJECT=rngxx
AUTHOR=Avril (Flanchan) <flanchan@cumallover.me> AUTHOR=Avril (Flanchan) <flanchan@cumallover.me>
VERSION_MAJOR=0 VERSION_MAJOR=1
VERSION_MINOR=3 VERSION_MINOR=0
VERSION=$(VERSION_MAJOR).$(VERSION_MINOR) VERSION=$(VERSION_MAJOR).$(VERSION_MINOR)
ifeq ($(PREFIX),) ifeq ($(PREFIX),)

@ -29,7 +29,8 @@ enum rng_next_flag {
RNG_TYQ_UNSIGNED = 1 << 0, RNG_TYQ_UNSIGNED = 1 << 0,
RNG_TYQ_CHAOS = 1 << 1, RNG_TYQ_CHAOS = 1 << 1,
}; // 2 bits RNG_TYQ_ARRAY = 1 << 2,
}; // 3 bits
typedef int rng_bool_t; typedef int rng_bool_t;
@ -60,9 +61,15 @@ struct rng_next_opt {
struct { struct {
enum rng_next_type type : 4; enum rng_next_type type : 4;
enum rng_next_flag mod : 2; enum rng_next_flag mod : 3;
uint8_t _unused : 2; uint8_t _unused0 : 1;
} ty; // 8 bits //first byte
uint32_t _padding : 24;
} ty; // 32 bits :/
union {
uint32_t array_size; //TODO: Implement next for arrays
} ex; // 32 bits. fills hole
}; };
typedef __typeof( ((struct rng_next_opt*)NULL)->ty ) rng_next_tyq; // Qualified type typedef __typeof( ((struct rng_next_opt*)NULL)->ty ) rng_next_tyq; // Qualified type
@ -74,6 +81,9 @@ typedef struct rng_dyn_ctor* rng_dyn_ctor_ref;
// -- // -- // -- // --
#ifndef _RNGXX_IMPL_ONLY_TYPES #ifndef _RNGXX_IMPL_ONLY_TYPES
_Static_assert(sizeof(rng_next_tyq) == sizeof(uint32_t));
_Static_assert(sizeof( ((struct rng_next_opt*)NULL)->ex ) == sizeof(uint32_t));
// -- C API functions -- (C++ NO compat) // -- C API functions -- (C++ NO compat)
int rng_raw(rng_t* engine, void* restrict output, struct rng_next_opt opt); int rng_raw(rng_t* engine, void* restrict output, struct rng_next_opt opt);

Loading…
Cancel
Save