Fix up system type detection for QRA PRNG

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7296 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2016-11-06 13:54:44 +00:00
parent 8390bcd798
commit aef04b28ff
1 changed files with 5 additions and 10 deletions

View File

@ -30,18 +30,13 @@
// Windows (x64 and x86) // Windows (x64 and x86)
#include <windows.h> // required only for GetTickCount(...) #include <windows.h> // required only for GetTickCount(...)
#define K_RAND_MAX UINT_MAX #define K_RAND_MAX UINT_MAX
#elif __unix__ // all unices, not all compilers #elif _SVID_SOURCE || _XOPEN_SOURCE || __unix__ || (defined (__APPLE__) && defined(__MACH__)) /* POSIX or Unix or Apple */
#include <stdlib.h> #include <stdlib.h>
#define rand_s(x) (*x)=(unsigned int)lrand48() // returns unsigned integers in the range 0..0x7FFFFFFF #define rand_s(x) (*x)=(unsigned int)lrand48() // returns unsigned integers in the range 0..0x7FFFFFFF
#define K_RAND_MAX 0x7FFFFFFF // that's the max number generated by lrand48 #define K_RAND_MAX 0x7FFFFFFF // that's the max number
// Unix // generated by lrand48
#elif __linux__ #else
#include <stdlib.h> #error "No good quality PRNG found"
#define rand_s(x) (*x)=(unsigned int)lrand48() // returns unsigned integers in the range 0..0x7FFFFFFF
#define K_RAND_MAX 0x7FFFFFFF // that's the max number generated by lrand48
// linux
#elif __APPLE__
// Mac OS, not sure if this is covered by __posix__ and/or __unix__ though...
#endif #endif