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.
28 lines
524 B
28 lines
524 B
// Contains the work-doing code for the C API interface, which should be exported to the C API shim in the header "capi-bridge.h"
|
|
|
|
#include <rngxx.hpp>
|
|
#include <rngxx/crand.h>
|
|
|
|
#include "capi-bridge.h"
|
|
|
|
extern "C" {
|
|
// Internal bridge members
|
|
_export(internal)
|
|
rng_t* RNG_IMPL(mkdriver)(rng_kind kind, u64* restrict seed)
|
|
{
|
|
switch(kind)
|
|
{
|
|
case RNG_KIND_CRAND:
|
|
return new rng::crand(seed[0]);
|
|
default: return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
// Direct C interface members
|
|
void rng_free(rng_t* rng)
|
|
{
|
|
delete rng;
|
|
}
|
|
}
|