commit cdfd1506dbf8930664b6e924652f5860f60b8fa0
parent 4ccbc1cabae78a3e7d2710d17d0a23f9fd872032
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 14 Apr 2015 11:58:52 +0200
Make constant the builtin RNG types
Diffstat:
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/ssp.h b/src/ssp.h
@@ -83,11 +83,11 @@ BEGIN_DECLS
/* David Jones's Keep It Simple Stupid builtin PRNG type. Suitable for fast
* basic randomness */
-SSP_API struct ssp_rng_type ssp_rng_kiss;
+SSP_API const struct ssp_rng_type ssp_rng_kiss;
/* 64-bits Mersenne Twister builtin PRNG type of Matsumoto and Nishimura, 2000 */
-SSP_API struct ssp_rng_type ssp_rng_mt19937_64;
+SSP_API const struct ssp_rng_type ssp_rng_mt19937_64;
/* 48-bits RANLUX builtin PRNG type of Lusher and James, 1994 */
-SSP_API struct ssp_rng_type ssp_rng_ranlux48;
+SSP_API const struct ssp_rng_type ssp_rng_ranlux48;
/*******************************************************************************
* API declaration
diff --git a/src/ssp_rng.c b/src/ssp_rng.c
@@ -138,7 +138,7 @@ rng_kiss_release(void* data)
}
/* Exported type */
-struct ssp_rng_type ssp_rng_kiss = {
+const struct ssp_rng_type ssp_rng_kiss = {
rng_kiss_init,
rng_kiss_release,
rng_kiss_set,
@@ -250,7 +250,7 @@ rng_cxx_release(void* data)
}
/* 64-bits Mersenne Twister PRNG */
-struct ssp_rng_type ssp_rng_mt19937_64 = {
+const struct ssp_rng_type ssp_rng_mt19937_64 = {
rng_cxx_init<std::mt19937_64>,
rng_cxx_release<std::mt19937_64>,
rng_cxx_set<std::mt19937_64>,
@@ -266,7 +266,7 @@ struct ssp_rng_type ssp_rng_mt19937_64 = {
};
/* 48-bits RANLUX PRNG */
-struct ssp_rng_type ssp_rng_ranlux48 = {
+const struct ssp_rng_type ssp_rng_ranlux48 = {
rng_cxx_init<std::ranlux48>,
rng_cxx_release<std::ranlux48>,
rng_cxx_set<std::ranlux48>,
diff --git a/src/test_ssp_rng.c b/src/test_ssp_rng.c
@@ -38,7 +38,7 @@
#define NRAND 1024
static void /* Really basic test */
-test_rng(struct ssp_rng_type* type)
+test_rng(const struct ssp_rng_type* type)
{
FILE* stream;
struct ssp_rng* rng;