pcg-c
pcg-c copied to clipboard
pcg-c fails to build unless 128-bit ops are supported (as e.g. on NetBSD/powerpc)
This popped up on my radar due to a build failure on NetBSD/powerpc. This platform does not have native support for 128-bit integer operations.
gcc -O2 -D_FORTIFY_SOURCE=2 -O3 -std=c99 -I../include -c -o pcg-global-32.o pcg-global-32.c
In file included from pcg-global-32.c:33:
../include/pcg_variants.h:2178:33: error: 'PCG_STATE_SETSEQ_64_INITIALIZER' undeclared here (not in a function)
2178 | #define PCG32_INITIALIZER PCG_STATE_SETSEQ_64_INITIALIZER
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pcg-global-32.c:35:38: note: in expansion of macro 'PCG32_INITIALIZER'
35 | static pcg32_random_t pcg32_global = PCG32_INITIALIZER;
| ^~~~~~~~~~~~~~~~~
gmake[1]: *** [<builtin>: pcg-global-32.o] Error 1
Inspecting include/pcg_variants.h
reveals that PCG_HAS_128BIT_OPS
ends up
as undefined on this platform, due to lack of __SIZEOF_INT128__
being defined, and
hence PCG_STATE_SETSEQ_64_INITIALIZER
also ends up being undefined, as it's
only defined if PCG_HAS_128BIT_OPS
is defined.