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.
This commit is contained in:
+23
-10
@@ -1,32 +1,42 @@
|
|||||||
/*Written by Timothy B. Terriberry (tterribe@xiph.org) 1999-2009
|
/*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.*/
|
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 <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "isaac64.h"
|
#include "isaac64.h"
|
||||||
|
|
||||||
#define ISAAC64_MASK ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
|
#define ISAAC64_MASK ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
|
||||||
|
|
||||||
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L)
|
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||||
#define HAS_INLINE
|
#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
|
#endif
|
||||||
|
|
||||||
/* Extract ISAAC64_SZ_LOG bits (starting at bit 3). */
|
/* Extract ISAAC64_SZ_LOG bits (starting at bit 3). */
|
||||||
#ifdef HAS_INLINE
|
|
||||||
static inline uint32_t lower_bits(uint64_t x)
|
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;
|
return (x & ((ISAAC64_SZ-1) << 3)) >>3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract next ISAAC64_SZ_LOG bits (starting at bit ISAAC64_SZ_LOG+2). */
|
/* 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)
|
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);
|
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)<d);
|
while(((d+_n-1)&ISAAC64_MASK)<d);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
#endif /* USE_ISAAC64 */
|
||||||
|
|
||||||
|
/*isaac64.c*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# NetHack Makefile.
|
# NetHack Makefile.
|
||||||
# NetHack 3.6 Makefile.src $NHDT-Date: 1546220381 2018/12/31 01:39:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $
|
# NetHack 3.6 Makefile.src $NHDT-Date: 1549834883 2019/02/10 21:41:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.69 $
|
||||||
# Copyright (c) 2018 by Pasi Kallinen
|
# Copyright (c) 2018 by Pasi Kallinen
|
||||||
# NetHack may be freely redistributed. See license for details.
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
@@ -1013,7 +1013,7 @@ fountain.o: fountain.c $(HACK_H)
|
|||||||
hack.o: hack.c $(HACK_H)
|
hack.o: hack.c $(HACK_H)
|
||||||
hacklib.o: hacklib.c $(HACK_H)
|
hacklib.o: hacklib.c $(HACK_H)
|
||||||
invent.o: invent.c $(HACK_H)
|
invent.o: invent.c $(HACK_H)
|
||||||
isaac64.o: isaac64.c ../include/isaac64.h ../include/integer.h
|
isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h ../include/integer.h
|
||||||
light.o: light.c $(HACK_H) ../include/lev.h
|
light.o: light.c $(HACK_H) ../include/lev.h
|
||||||
lock.o: lock.c $(HACK_H)
|
lock.o: lock.c $(HACK_H)
|
||||||
mail.o: mail.c $(HACK_H) ../include/mail.h
|
mail.o: mail.c $(HACK_H) ../include/mail.h
|
||||||
|
|||||||
Reference in New Issue
Block a user