From f067a3e9ff9af6fc6f945138527c59b8f3e0c370 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 10 Feb 2019 13:41:45 -0800 Subject: [PATCH] compiling isaac64.c Revise isaac64.c so that it can be compiled unconditionally and yield nothing if USE_ISAAC64 isn't defined. Necessary for building via vmsbuild.com. --- src/isaac64.c | 33 +++++++++++++++++++++++---------- sys/unix/Makefile.src | 4 ++-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/isaac64.c b/src/isaac64.c index 6928ff72b..9ccb0db55 100644 --- a/src/isaac64.c +++ b/src/isaac64.c @@ -1,32 +1,42 @@ /*Written by Timothy B. Terriberry (tterribe@xiph.org) 1999-2009 - CC0 (Public domain) - see http://creativecommons.org/publicdomain/zero/1.0/ for details + CC0 (Public domain) - see http://creativecommons.org/publicdomain/zero/1.0/ + for details. Based on the public domain ISAAC implementation by Robert J. Jenkins Jr.*/ + +/* + * Changes for NetHack: + * include config.h; + * skip rest of file if USE_ISAAC64 isn't defined there; + * re-do 'inline' handling. + */ +#include "config.h" + +#ifdef USE_ISAAC64 #include #include #include "isaac64.h" #define ISAAC64_MASK ((uint64_t)0xFFFFFFFFFFFFFFFFULL) -#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) #define HAS_INLINE +#else +# if (defined(__GNUC__) && __GNUC__ >= 2 && !defined(inline)) +# define inline __inline__ +# endif +#endif +#if !defined(HAS_INLINE) && !defined(inline) +#define inline /*empty*/ #endif /* Extract ISAAC64_SZ_LOG bits (starting at bit 3). */ -#ifdef HAS_INLINE static inline uint32_t lower_bits(uint64_t x) -#else -static uint32_t lower_bits(uint64_t x) -#endif { return (x & ((ISAAC64_SZ-1) << 3)) >>3; } /* Extract next ISAAC64_SZ_LOG bits (starting at bit ISAAC64_SZ_LOG+2). */ -#ifdef HAS_INLINE static inline uint32_t upper_bits(uint64_t y) -#else -static uint32_t upper_bits(uint64_t y) -#endif { return (y >> (ISAAC64_SZ_LOG+3)) & (ISAAC64_SZ-1); } @@ -159,3 +169,6 @@ uint64_t isaac64_next_uint(isaac64_ctx *_ctx,uint64_t _n){ while(((d+_n-1)&ISAAC64_MASK)