star-sp

Random number generators and distributions
git clone git://git.meso-star.fr/star-sp.git
Log | Files | Refs | README | LICENSE

commit 8b7f4dddb43c85722b51cf454d32cc157ee5c0a4
parent 5fd60d2065db390a2cebc718426f2c9af66111c9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon,  9 Jul 2018 16:02:45 +0200

Workaround what it seems a GCC bug on the creation of a RNG

A segfault occurred on the copy of the RNG type.

Diffstat:
Msrc/ssp_rng.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ssp_rng.c b/src/ssp_rng.c @@ -495,7 +495,7 @@ ssp_rng_create } res = type->init(allocator, rng->state); if(res != RES_OK) goto error; - rng->type = *type; + memcpy(&rng->type, type, sizeof(*type)); /* Precompute some values for the canonical distribution */ rng->r = (long double)rng->type.max - (long double)rng->type.min + 1.0L;