You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.4 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../gnubg/gcc4.patch
# Copyright (C) 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
diff -Nur gnubg-0.14.3-orig/eval.c gnubg-0.14.3/eval.c
--- gnubg-0.14.3-orig/eval.c 2004-05-07 05:20:21.000000000 +0000
+++ gnubg-0.14.3/eval.c 2006-01-26 13:30:59.383449250 +0000
@@ -798,7 +798,10 @@
if( !fstat( h, &st ) &&
( p = mmap( NULL, st.st_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE, h, 0 ) ) ) {
- ( (float *) p ) += 2; /* skip magic number and version */
+// ( (float *) p ) += 2; /* skip magic number and version */
+ float *pf = p;
+ p += 2;
+ p = pf;
fReadWeights =
( p = NeuralNetCreateDirect( &nnContact, p ) ) &&
( p = NeuralNetCreateDirect( &nnRace, p ) ) &&
diff -Nur gnubg-0.14.3-orig/lib/neuralnet.c gnubg-0.14.3/lib/neuralnet.c
--- gnubg-0.14.3-orig/lib/neuralnet.c 2004-02-24 10:15:50.000000000 +0000
+++ gnubg-0.14.3/lib/neuralnet.c 2006-01-26 13:24:02.577400500 +0000
@@ -386,13 +386,23 @@
}
extern void *NeuralNetCreateDirect( neuralnet *pnn, void *p ) {
- pnn->cInput = *( ( (int *) p )++ );
- pnn->cHidden = *( ( (int *) p )++ );
- pnn->cOutput = *( ( (int *) p )++ );
- pnn->nTrained = *( ( (int *) p )++ );
+ float *fp;
+ int *ip = ( int *)p;
+
+ pnn->cInput = *ip;
+ ip++;
+ pnn->cHidden = *ip;
+ ip++;
+ pnn->cOutput = *ip;
+ ip++;
+ pnn->nTrained = *ip;
+ ip++;
pnn->fDirect = TRUE;
- pnn->rBetaHidden = *( ( (float *) p )++ );
- pnn->rBetaOutput = *( ( (float *) p )++ );
+ fp = (float*)ip;
+ pnn->rBetaHidden = *fp;
+ fp++;
+ pnn->rBetaOutput = *fp;
+ fp++;
if( pnn->cInput < 1 || pnn->cHidden < 1 || pnn->cOutput < 1 ||
pnn->nTrained < 0 || pnn->rBetaHidden <= 0.0 ||
@@ -402,19 +412,19 @@
return NULL;
}
- pnn->arHiddenWeight = p;
- ( (float *) p ) += pnn->cInput * pnn->cHidden;
- pnn->arOutputWeight = p;
- ( (float *) p ) += pnn->cHidden * pnn->cOutput;
- pnn->arHiddenThreshold = p;
- ( (float *) p ) += pnn->cHidden;
- pnn->arOutputThreshold = p;
- ( (float *) p ) += pnn->cOutput;
+ pnn->arHiddenWeight = fp;
+ fp += pnn->cInput * pnn->cHidden;
+ pnn->arOutputWeight = fp;
+ fp += pnn->cHidden * pnn->cOutput;
+ pnn->arHiddenThreshold = fp;
+ fp += pnn->cHidden;
+ pnn->arOutputThreshold = fp;
+ fp += pnn->cOutput;
pnn->savedBase = malloc( pnn->cHidden * sizeof( float ) );
pnn->savedIBase = malloc( pnn->cInput * sizeof( float ) );
- return p;
+ return fp;
}
extern int
diff -Nur gnubg-0.14.3-orig/rollout.c gnubg-0.14.3/rollout.c
--- gnubg-0.14.3-orig/rollout.c 2004-05-07 05:20:21.000000000 +0000
+++ gnubg-0.14.3/rollout.c 2006-01-26 13:32:38.445640250 +0000
@@ -219,7 +219,7 @@
nPermutationSeed = n;
}
-static int nSkip;
+int nSkip;
static int RolloutDice( int iTurn, int iGame, int cGames,
int fInitial,