ref: eaac150672ef7035c48d7f9f4f7e0919dcd31ab3
parent: 561e0b07e1d030695805b830be90db0838821758
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Wed Aug 4 15:03:19 EDT 2010
misc. updates, mostly about portability and warnings removing some unnecessary #includes
--- a/femtolisp/builtins.c
+++ b/femtolisp/builtins.c
@@ -411,7 +411,7 @@
static value_t fl_rand32(value_t *args, u_int32_t nargs)
{
(void)args; (void)nargs;
- ulong r = random();
+ uint32_t r = random();
#ifdef BITS64
return fixnum(r);
#else
--- a/femtolisp/cvalues.c
+++ b/femtolisp/cvalues.c
@@ -651,7 +651,7 @@
return cv_type((cvalue_t*)ptr(args[0]));
}
-value_t cvalue_relocate(value_t v)
+static value_t cvalue_relocate(value_t v)
{
size_t nw;
cvalue_t *cv = (cvalue_t*)ptr(v);
@@ -840,7 +840,7 @@
{
char *data; ulong_t index;
fltype_t *eltype = cv_class((cvalue_t*)ptr(args[0]))->eltype;
- value_t el;
+ value_t el = 0;
numerictype_t nt = eltype->numtype;
if (nt >= T_INT32)
el = cvalue(eltype, eltype->size);
@@ -885,7 +885,7 @@
symbol_t *name = tosymbol(args[0], "builtin");
cvalue_t *cv;
if (ismanaged(args[0]) || (cv=name->dlcache) == NULL) {
- lerror(ArgError, "builtin: function not found");
+ lerrorf(ArgError, "builtin: function %s not found", name->name);
}
return tagptr(cv, TAG_CVALUE);
}
--- a/femtolisp/equalhash.c
+++ b/femtolisp/equalhash.c
@@ -7,7 +7,10 @@
#include "llt.h"
#include "flisp.h"
+#include "equalhash.h"
#include "htable.inc"
-HTIMPL(equalhash, hash_lispvalue, equal_lispvalue)
+#define _equal_lispvalue_(x,y) equal_lispvalue((value_t)(x),(value_t)(y))
+
+HTIMPL(equalhash, hash_lispvalue, _equal_lispvalue_)
--- a/femtolisp/flisp.c
+++ b/femtolisp/flisp.c
@@ -393,7 +393,7 @@
// print ----------------------------------------------------------------------
static int isnumtok(char *tok, value_t *pval);
-static int symchar(char c);
+static inline int symchar(char c);
#include "print.c"
@@ -593,7 +593,7 @@
tospace = temp;
if (grew) {
heapsize*=2;
- temp = bitvector_resize(consflags, heapsize/sizeof(cons_t), 1);
+ temp = bitvector_resize(consflags, 0, heapsize/sizeof(cons_t), 1);
if (temp == NULL)
fl_raise(memory_exception_value);
consflags = (uint32_t*)temp;
@@ -936,7 +936,7 @@
VM_APPLY_LABELS;
uint32_t top_frame = curr_frame;
// frame variables
- uint32_t n, captured;
+ uint32_t n=0, captured;
uint32_t bp;
const uint8_t *ip;
fixnum_t s, hi;
--- a/femtolisp/print.c
+++ b/femtolisp/print.c
@@ -489,6 +489,7 @@
char buf[512];
size_t i = 0;
uint8_t c;
+ static char hexdig[] = "0123456789abcdef";
outc('"', f);
if (!u8_isvalid(str, sz)) {
@@ -501,8 +502,11 @@
outsn("\\\"", f, 2);
else if (c >= 32 && c < 0x7f)
outc(c, f);
- else
- HPOS += ios_printf(f, "\\x%02x", c);
+ else {
+ outsn("\\x", f, 2);
+ outc(hexdig[c>>4], f);
+ outc(hexdig[c&0xf], f);
+ }
}
}
else {
@@ -709,10 +713,14 @@
(unsigned long)(builtin_t)fptr);
}
else {
- if (print_princ)
+ if (print_princ) {
outs(symbol_name(label), f);
- else
- HPOS += ios_printf(f, "#fn(%s)", symbol_name(label));
+ }
+ else {
+ outsn("#fn(", f, 4);
+ outs(symbol_name(label), f);
+ outc(')', f);
+ }
}
}
else if (cv_class(cv)->vtable != NULL &&
--- a/femtolisp/string.c
+++ b/femtolisp/string.c
@@ -339,9 +339,9 @@
return size_wrap(i);
}
-static ulong get_radix_arg(value_t arg, char *fname)
+static unsigned long get_radix_arg(value_t arg, char *fname)
{
- ulong radix = toulong(arg, fname);
+ unsigned long radix = toulong(arg, fname);
if (radix < 2 || radix > 36)
lerrorf(ArgError, "%s: invalid radix", fname);
return radix;
@@ -362,7 +362,7 @@
num = -num;
neg = 1;
}
- ulong radix = 10;
+ unsigned long radix = 10;
if (nargs == 2)
radix = get_radix_arg(args[1], "number->string");
char buf[128];
--- a/llt/bitvector.c
+++ b/llt/bitvector.c
@@ -40,19 +40,23 @@
#include <malloc.h>
#endif
-u_int32_t *bitvector_resize(u_int32_t *b, u_int64_t n, int initzero)
+u_int32_t *bitvector_resize(u_int32_t *b, uint64_t oldsz, uint64_t newsz,
+ int initzero)
{
u_int32_t *p;
- size_t sz = ((n+31)>>5) * 4;
+ size_t sz = ((newsz+31)>>5) * sizeof(uint32_t);
p = LLT_REALLOC(b, sz);
if (p == NULL) return NULL;
- if (initzero) memset(p, 0, sz);
+ if (initzero && newsz>oldsz) {
+ size_t osz = ((oldsz+31)>>5) * sizeof(uint32_t);
+ memset(&p[osz], 0, sz-osz);
+ }
return p;
}
u_int32_t *bitvector_new(u_int64_t n, int initzero)
{
- return bitvector_resize(NULL, n, initzero);
+ return bitvector_resize(NULL, 0, n, initzero);
}
size_t bitvector_nwords(u_int64_t nbits)
@@ -71,4 +75,51 @@
u_int32_t bitvector_get(u_int32_t *b, u_int64_t n)
{
return b[n>>5] & (1<<(n&31));
+}
+
+static int ntz(uint32_t x)
+{
+ int n;
+
+ if (x == 0) return 32;
+ n = 1;
+ if ((x & 0x0000FFFF) == 0) {n = n +16; x = x >>16;}
+ if ((x & 0x000000FF) == 0) {n = n + 8; x = x >> 8;}
+ if ((x & 0x0000000F) == 0) {n = n + 4; x = x >> 4;}
+ if ((x & 0x00000003) == 0) {n = n + 2; x = x >> 2;}
+ return n - (x & 1);
+}
+
+// given a bitvector of n bits, starting at bit n0 find the next
+// set bit, including n0.
+// returns n if no set bits.
+uint32_t bitvector_next(uint32_t *b, uint64_t n0, uint64_t n)
+{
+ if (n == 0) return 0;
+
+ uint32_t i = n0>>5;
+ uint32_t nb = n0&31;
+ uint32_t nw = (n+31)>>5;
+
+ uint32_t w = b[i]>>nb;
+ if (w != 0)
+ return ntz(w)+n0;
+ if (nw == 1)
+ return n;
+ i++;
+ while (i < nw-1) {
+ w = b[i];
+ if (w != 0) {
+ return ntz(w) + (i<<5);
+ }
+ i++;
+ }
+ w = b[i];
+ nb = n&31;
+ i = ntz(w);
+ if (nb == 0)
+ return i + (n-32);
+ if (i >= nb)
+ return n;
+ return i + (n-nb);
}
--- a/llt/bitvector.h
+++ b/llt/bitvector.h
@@ -32,10 +32,13 @@
u_int32_t bitreverse(u_int32_t x);
u_int32_t *bitvector_new(u_int64_t n, int initzero);
-u_int32_t *bitvector_resize(u_int32_t *b, u_int64_t n, int initzero);
+u_int32_t *bitvector_resize(u_int32_t *b, uint64_t oldsz, uint64_t newsz,
+ int initzero);
size_t bitvector_nwords(u_int64_t nbits);
void bitvector_set(u_int32_t *b, u_int64_t n, u_int32_t c);
u_int32_t bitvector_get(u_int32_t *b, u_int64_t n);
+
+uint32_t bitvector_next(uint32_t *b, uint64_t n0, uint64_t n);
void bitvector_shr(u_int32_t *b, size_t n, u_int32_t s);
void bitvector_shr_to(u_int32_t *dest, u_int32_t *b, size_t n, u_int32_t s);
--- a/llt/cplxprint.c
+++ b/llt/cplxprint.c
@@ -1,7 +1,6 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
-#include "ieee754.h"
#include "dtypes.h"
#include "utils.h"
--- a/llt/dblprint.c
+++ b/llt/dblprint.c
@@ -4,6 +4,7 @@
#include <stdio.h>
#include "dtypes.h"
#include "ieee754.h"
+#include "utils.h"
int double_exponent(double d)
{
--- a/llt/dtypes.h
+++ b/llt/dtypes.h
@@ -16,6 +16,18 @@
We assume the LP64 convention for 64-bit platforms.
*/
+#ifdef WIN32
+#define STDCALL __stdcall
+# ifdef IMPORT_EXPORTS
+# define DLLEXPORT __declspec(dllimport)
+# else
+# define DLLEXPORT __declspec(dllexport)
+# endif
+#else
+#define STDCALL
+#define DLLEXPORT __attribute__ ((visibility("default")))
+#endif
+
#ifdef LINUX
#include <features.h>
#include <endian.h>
--- a/llt/dump.c
+++ b/llt/dump.c
@@ -1,5 +1,4 @@
#include <stdlib.h>
-#include <stdarg.h>
#include "dtypes.h"
#include "ios.h"
#include "utils.h"
--- a/llt/hashing.c
+++ b/llt/hashing.c
@@ -4,7 +4,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
-#include "ieee754.h"
#include "dtypes.h"
#include "utils.h"
#include "hashing.h"
--- a/llt/ieee754.h
+++ b/llt/ieee754.h
@@ -1,135 +1,51 @@
-/* Copyright (C) 1992, 1995, 1996, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+#ifndef __IEEE754_H_
+#define __IEEE754_H_
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _IEEE754_H
-
-#define _IEEE754_H 1
-
-union ieee754_float
- {
+union ieee754_float {
float f;
- /* This is the IEEE 754 single-precision format. */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct {
+#if BYTE_ORDER == BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:8;
unsigned int mantissa:23;
-#endif /* Big endian. */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
unsigned int mantissa:23;
unsigned int exponent:8;
unsigned int negative:1;
-#endif /* Little endian. */
- } ieee;
+#endif
+ } ieee;
+};
- /* This format makes it easier to see if a NaN is a signalling NaN. */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned int negative:1;
- unsigned int exponent:8;
- unsigned int quiet_nan:1;
- unsigned int mantissa:22;
-#endif /* Big endian. */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- unsigned int mantissa:22;
- unsigned int quiet_nan:1;
- unsigned int exponent:8;
- unsigned int negative:1;
-#endif /* Little endian. */
- } ieee_nan;
- };
+#define IEEE754_FLOAT_BIAS 0x7f
-#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
-
-
-union ieee754_double
- {
+union ieee754_double {
double d;
- /* This is the IEEE 754 double-precision format. */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct {
+#if BYTE_ORDER == BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
- /* Together these comprise the mantissa. */
unsigned int mantissa0:20;
unsigned int mantissa1:32;
-#endif /* Big endian. */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
- unsigned int mantissa0:20;
- unsigned int exponent:11;
- unsigned int negative:1;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
unsigned int mantissa1:32;
-# else
- /* Together these comprise the mantissa. */
- unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
-# endif
-#endif /* Little endian. */
- } ieee;
-
- /* This format makes it easier to see if a NaN is a signalling NaN. */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned int negative:1;
- unsigned int exponent:11;
- unsigned int quiet_nan:1;
- /* Together these comprise the mantissa. */
- unsigned int mantissa0:19;
- unsigned int mantissa1:32;
-#else
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
- unsigned int mantissa0:19;
- unsigned int quiet_nan:1;
- unsigned int exponent:11;
- unsigned int negative:1;
- unsigned int mantissa1:32;
-# else
- /* Together these comprise the mantissa. */
- unsigned int mantissa1:32;
- unsigned int mantissa0:19;
- unsigned int quiet_nan:1;
- unsigned int exponent:11;
- unsigned int negative:1;
-# endif
#endif
- } ieee_nan;
- };
+ } ieee;
+};
-#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
+#define IEEE754_DOUBLE_BIAS 0x3ff
-
-union ieee854_long_double
- {
+union ieee854_long_double {
long double d;
- /* This is the IEEE 854 double-extended-precision format. */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
+ struct {
+#if BYTE_ORDER == BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:15;
unsigned int empty:16;
@@ -136,57 +52,16 @@
unsigned int mantissa0:32;
unsigned int mantissa1:32;
#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
- unsigned int exponent:15;
- unsigned int negative:1;
- unsigned int empty:16;
- unsigned int mantissa0:32;
+#if BYTE_ORDER == LITTLE_ENDIAN
unsigned int mantissa1:32;
-# else
- unsigned int mantissa1:32;
unsigned int mantissa0:32;
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
-# endif
#endif
- } ieee;
+ } ieee;
+};
- /* This is for NaNs in the IEEE 854 double-extended-precision format. */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned int negative:1;
- unsigned int exponent:15;
- unsigned int empty:16;
- unsigned int one:1;
- unsigned int quiet_nan:1;
- unsigned int mantissa0:30;
- unsigned int mantissa1:32;
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
- unsigned int exponent:15;
- unsigned int negative:1;
- unsigned int empty:16;
- unsigned int mantissa0:30;
- unsigned int quiet_nan:1;
- unsigned int one:1;
- unsigned int mantissa1:32;
-# else
- unsigned int mantissa1:32;
- unsigned int mantissa0:30;
- unsigned int quiet_nan:1;
- unsigned int one:1;
- unsigned int exponent:15;
- unsigned int negative:1;
- unsigned int empty:16;
-# endif
-#endif
- } ieee_nan;
- };
-
#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
-#endif /* ieee754.h */
+#endif
--- a/llt/lltinit.c
+++ b/llt/lltinit.c
@@ -3,7 +3,6 @@
#include <stdarg.h>
#include <math.h>
#include <locale.h>
-#include "ieee754.h"
#include "dtypes.h"
#include "timefuncs.h"
#include "ios.h"
--- a/llt/mt19937ar.c
+++ b/llt/mt19937ar.c
@@ -46,25 +46,25 @@
/* Period parameters */
#define mtN 624
#define mtM 397
-#define MATRIX_A 0x9908b0dfUL /* constant vector a */
-#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
-#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
+#define MATRIX_A 0x9908b0dfU /* constant vector a */
+#define UPPER_MASK 0x80000000U /* most significant w-r bits */
+#define LOWER_MASK 0x7fffffffU /* least significant r bits */
-static unsigned long mt[mtN]; /* the array for the state vector */
+static uint32_t mt[mtN]; /* the array for the state vector */
static int mti=mtN+1; /* mti==mtN+1 means mt[mtN] is not initialized */
/* initializes mt[mtN] with a seed */
-void init_genrand(unsigned long s)
+void init_genrand(uint32_t s)
{
- mt[0]= s & 0xffffffffUL;
+ mt[0]= s & 0xffffffffU;
for (mti=1; mti<mtN; mti++) {
mt[mti] =
- (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
+ (1812433253U * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
/* In the previous versions, MSBs of the seed affect */
/* only MSBs of the array mt[]. */
/* 2002/01/09 modified by Makoto Matsumoto */
- mt[mti] &= 0xffffffffUL;
+ mt[mti] &= 0xffffffffU;
/* for >32 bit machines */
}
}
@@ -73,36 +73,36 @@
/* init_key is the array for initializing keys */
/* key_length is its length */
/* slight change for C++, 2004/2/26 */
-void init_by_array(unsigned long init_key[], int key_length)
+void init_by_array(uint32_t init_key[], int key_length)
{
int i, j, k;
- init_genrand(19650218UL);
+ init_genrand(19650218U);
i=1; j=0;
k = (mtN>key_length ? mtN : key_length);
for (; k; k--) {
- mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525U))
+ init_key[j] + j; /* non linear */
- mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
+ mt[i] &= 0xffffffffU; /* for WORDSIZE > 32 machines */
i++; j++;
if (i>=mtN) { mt[0] = mt[mtN-1]; i=1; }
if (j>=key_length) j=0;
}
for (k=mtN-1; k; k--) {
- mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941U))
- i; /* non linear */
- mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
+ mt[i] &= 0xffffffffU; /* for WORDSIZE > 32 machines */
i++;
if (i>=mtN) { mt[0] = mt[mtN-1]; i=1; }
}
- mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
+ mt[0] = 0x80000000U; /* MSB is 1; assuring non-zero initial array */
}
/* generates a random number on [0,0xffffffff]-interval */
-unsigned long genrand_int32(void)
+uint32_t genrand_int32(void)
{
- unsigned long y;
- static unsigned long mag01[2]={0x0UL, MATRIX_A};
+ uint32_t y;
+ static uint32_t mag01[2]={0x0U, MATRIX_A};
/* mag01[x] = x * MATRIX_A for x=0,1 */
if (mti >= mtN) { /* generate mtN words at one time */
@@ -109,18 +109,18 @@
int kk;
if (mti == mtN+1) /* if init_genrand() has not been called, */
- init_genrand(5489UL); /* a default initial seed is used */
+ init_genrand(5489U); /* a default initial seed is used */
for (kk=0;kk<mtN-mtM;kk++) {
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
- mt[kk] = mt[kk+mtM] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ mt[kk] = mt[kk+mtM] ^ (y >> 1) ^ mag01[y & 0x1U];
}
for (;kk<mtN-1;kk++) {
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
- mt[kk] = mt[kk+(mtM-mtN)] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ mt[kk] = mt[kk+(mtM-mtN)] ^ (y >> 1) ^ mag01[y & 0x1U];
}
y = (mt[mtN-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
- mt[mtN-1] = mt[mtM-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ mt[mtN-1] = mt[mtM-1] ^ (y >> 1) ^ mag01[y & 0x1U];
mti = 0;
}
@@ -129,8 +129,8 @@
/* Tempering */
y ^= (y >> 11);
- y ^= (y << 7) & 0x9d2c5680UL;
- y ^= (y << 15) & 0xefc60000UL;
+ y ^= (y << 7) & 0x9d2c5680U;
+ y ^= (y << 15) & 0xefc60000U;
y ^= (y >> 18);
return y;
@@ -167,7 +167,7 @@
/* generates a random number on [0,1) with 53-bit resolution*/
double genrand_res53(void)
{
- unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
+ uint32_t a=genrand_int32()>>5, b=genrand_int32()>>6;
return(a*67108864.0+b)*(1.0/9007199254740992.0);
}
#endif
@@ -176,7 +176,7 @@
int main(void)
{
int i;
- unsigned long init[4]={0x123, 0x234, 0x345, 0x456}, length=4;
+ uint32_t init[4]={0x123, 0x234, 0x345, 0x456}, length=4;
init_by_array(init, length);
printf("1000 outputs of genrand_int32()\n");
for (i=0; i<1000; i++) {
--- a/llt/ptrhash.c
+++ b/llt/ptrhash.c
@@ -11,7 +11,6 @@
#include "dtypes.h"
#include "ptrhash.h"
-#include "hashing.h"
#define OP_EQ(x,y) ((x)==(y))
--- a/llt/random.c
+++ b/llt/random.c
@@ -16,8 +16,8 @@
{
union ieee754_double d;
- d.ieee.mantissa0 = random();
- d.ieee.mantissa1 = random();
+ d.ieee.mantissa0 = genrand_int32();
+ d.ieee.mantissa1 = genrand_int32();
d.ieee.negative = 0;
d.ieee.exponent = IEEE754_DOUBLE_BIAS + 0; /* 2^0 */
return d.d - 1.0;
@@ -27,7 +27,7 @@
{
union ieee754_float f;
- f.ieee.mantissa = random();
+ f.ieee.mantissa = genrand_int32();
f.ieee.negative = 0;
f.ieee.exponent = IEEE754_FLOAT_BIAS + 0; /* 2^0 */
return f.f - 1.0;
@@ -58,5 +58,5 @@
void randomize()
{
u_int64_t tm = i64time();
- init_by_array((unsigned long*)&tm, 2);
+ init_by_array((uint32_t*)&tm, 2);
}
--- a/llt/random.h
+++ b/llt/random.h
@@ -7,8 +7,8 @@
float rand_float();
double randn();
void randomize();
-unsigned long genrand_int32();
-void init_genrand(unsigned long s);
+uint32_t genrand_int32();
+void init_genrand(uint32_t s);
u_int64_t i64time();
#endif
--- a/llt/socket.h
+++ b/llt/socket.h
@@ -1,5 +1,5 @@
-#ifndef __JCSOCKET_H_
-#define __JCSOCKET_H_
+#ifndef __LLTSOCKET_H_
+#define __LLTSOCKET_H_
#ifdef WIN32
#include <winsock2.h>
--- a/llt/timefuncs.c
+++ b/llt/timefuncs.c
@@ -81,9 +81,9 @@
void timestring(double seconds, char *buffer, size_t len)
{
time_t tme = (time_t)seconds;
- char *fmt = "%c"; /* needed to suppress GCC warning */
#ifdef LINUX
+ char *fmt = "%c"; /* needed to suppress GCC warning */
struct tm tm;
localtime_r(&tme, &tm);