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.
rngxx/src/capi.c

23 lines
673 B

// Contains the library exported C API functions.
// Actual work may be done in `capi-bridge.cpp`, `capi-bridge.h` bridges this shim TU with that working one
#include <stdio.h>
#include <stdlib.h>
#include <common.h>
#include <rngxx.h>
#include "capi-bridge.h"
#define assert_not_null(expr, ...) ({ __auto_type _nn__expr = (expr); \
if(UNLIKELY(_nn__expr == NULL)) { fprintf(stderr, "fatal (unexpected null pointer): " __VA_ARGS__); abort(); } \
_nn__expr; })
rng_t* rng_new(enum rng_kind kind, u64 seed[static restrict 1])
{
return assert_not_null(RNG_IMPL(mkdriver) (kind, &seed[0]), "invalid kind %d", (int)kind);
}
// void rng_free() - direct bridge