[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnubg] 64 bit gnubg fixes [patch]
From: |
Alex Romosan |
Subject: |
[Bug-gnubg] 64 bit gnubg fixes [patch] |
Date: |
Mon, 24 Apr 2006 17:25:41 -0700 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
the attached patch lets me run gnubg on my amd64 linux machine. i hope
i didn't change the logic in renderprefs.c (the present code is wrong
on a 64bit machine as it uses integers and pointers to char
interchangeably, but on a 64 bit machine the two have different
sizes). the other changes should be correct.
Index: renderprefs.c
===================================================================
RCS file: /cvsroot/gnubg/gnubg/renderprefs.c,v
retrieving revision 1.17
diff -u -r1.17 renderprefs.c
--- renderprefs.c 13 May 2004 10:25:29 -0000 1.17
+++ renderprefs.c 25 Apr 2006 00:20:00 -0000
@@ -158,21 +158,21 @@
#endif /* USE_GTK */
#if USE_BOARD3D
-static int SetMaterialCommon(Material* pMat, char *sz)
+static char* SetMaterialCommon(Material* pMat, char *sz)
{
float opac;
char* pch;
if (SetColourF(pMat->ambientColour, sz) != 0)
- return -1;
+ return (char*)0;
sz += strlen(sz) + 1;
if (SetColourF(pMat->diffuseColour, sz) != 0)
- return -1;
+ return (char*)0;
sz += strlen(sz) + 1;
if (SetColourF(pMat->specularColour, sz) != 0)
- return -1;
+ return (char*)0;
if (sz)
sz += strlen(sz) + 1;
@@ -206,38 +206,42 @@
{
sz += strlen(sz) + 1;
if (sz && *sz)
- return (int)sz;
+ return sz;
}
- return 0;
+ return (char*)0;
}
static int SetMaterial(Material* pMat, char *sz)
{
+ int result = -1;
if (fX)
{
- sz = (char*)SetMaterialCommon(pMat, sz);
+ sz = SetMaterialCommon(pMat, sz);
pMat->textureInfo = 0;
pMat->pTexture = 0;
- if (sz > 0)
+ if (sz != 0)
{
FindTexture(&pMat->textureInfo, sz);
- sz = 0;
+ sz = (char*)0;
+ result = 0 ;
}
}
- return (int)sz;
+ return result;
}
static int SetMaterialDice(Material* pMat, char *sz, int* flag)
{
- sz = (char*)SetMaterialCommon(pMat, sz);
+ int result = -1;
+ sz = SetMaterialCommon(pMat, sz);
/* die colour same as chequer colour */
*flag = TRUE;
- if (sz > 0)
+ if (sz != 0)
{
*flag = (toupper(*sz) == 'Y');
sz = 0;
+ result = 0;
}
- return (int)sz;
+ return result;
}
#endif
Index: board3d/misc3d.c
===================================================================
RCS file: /cvsroot/gnubg/gnubg/board3d/misc3d.c,v
retrieving revision 1.51
diff -u -r1.51 misc3d.c
--- board3d/misc3d.c 12 Apr 2006 06:53:35 -0000 1.51
+++ board3d/misc3d.c 25 Apr 2006 00:20:00 -0000
@@ -831,12 +831,12 @@
float ***Alloc3d(int x, int y, int z)
{ /* Allocate 3d array */
int i, j;
- float ***array = (float ***)malloc(sizeof(float) * x);
+ float ***array = (float ***)malloc(sizeof(float*) * x);
for (i = 0; i < x; i++)
{
- array[i] = (float **)malloc(sizeof(float) * y);
+ array[i] = (float **)malloc(sizeof(float*) * y);
for (j = 0; j < y; j++)
- array[i][j] = (float *)malloc(sizeof(float) * z);
+ array[i][j] = (float *)malloc(sizeof(float*) * z);
}
return array;
}
Index: lib/neuralnet.c
===================================================================
RCS file: /cvsroot/gnubg/gnubg/lib/neuralnet.c,v
retrieving revision 1.28
diff -u -r1.28 neuralnet.c
--- lib/neuralnet.c 12 Apr 2006 23:45:51 -0000 1.28
+++ lib/neuralnet.c 25 Apr 2006 00:20:00 -0000
@@ -37,6 +37,10 @@
#if HAVE_LIBATLAS
#warning "LIBATLAS processing..."
#include <cblas.h>
+static int EvaluateBlas( neuralnet *pnn, float arInput[], float ar[],
+ float arOutput[], float *saveAr );
+static int EvaluateFromBaseBlas( neuralnet *pnn, float arInputDif[], float
ar[],
+ float arOutput[] );
#endif /* HAVE_LIBATLAS */
#include "sse.h"
--alex--
--
| I believe the moment is at hand when, by a paranoiac and active |
| advance of the mind, it will be possible (simultaneously with |
| automatism and other passive states) to systematize confusion |
| and thus to help to discredit completely the world of reality. |
- [Bug-gnubg] 64 bit gnubg fixes [patch],
Alex Romosan <=