Package: golly
Version: 1.3-2
Severity: important
Tags: patch
--- Please enter the report below this line. ---
The current golly package is not built for the amd64 architecture and fails
to build due to several
error: cast from ‘node*’ to ‘int’ loses precision
The attached patch allows golly to build and run on amd64. I'm running lenny
with gcc 4.2.3.
Best regards
Davide Cavalca
--- System information. ---
Architecture: amd64
Kernel: Linux 2.6.22-3-amd64
Debian Release: lenny/sid
500 testing www.debian-multimedia.org
500 testing security.debian.org
500 testing mi.mirror.garr.it
--- Package information. ---
Depends (Version) | Installed
======================================-+-====================
libc6 (>= 2.7-1) | 2.7-6
libgcc1 (>= 1:4.1.1-21) | 1:4.3.0~rc2-1
libperl5.8 (>= 5.8.8) | 5.8.8-12
libstdc++6 (>= 4.1.1-21) | 4.3.0~rc2-1
libwxbase2.6-0 (>= 2.6.3.2.2) | 2.6.3.2.2-2
libwxgtk2.6-0 (>= 2.6.3.2.2) | 2.6.3.2.2-2
zlib1g (>= 1:1.2.3.3.dfsg) | 1:1.2.3.3.dfsg-11
diff -uN golly-1.3/hlifealgo.cpp golly-1.3-amd64/hlifealgo.cpp
--- golly-1.3/hlifealgo.cpp 2007-10-21 01:31:01.000000000 +0200
+++ golly-1.3-amd64/hlifealgo.cpp 2008-03-09 15:14:26.000000000 +0100
@@ -116,7 +116,7 @@
* We do now support garbage collection, but there are some routines we
* call frequently to help us.
*/
-#define node_hash(a,b,c,d) (((int)d)+3*(((int)c)+3*(((int)b)+3*((int)a)+3)))
+#define node_hash(a,b,c,d) (((long)d)+3*(((long)c)+3*(((long)b)+3*((long)a)+3)))
#define leaf_hash(a,b,c,d) ((d)+9*((c)+9*((b)+9*(a))))
/*
* Resize the hash.
@@ -1093,17 +1093,17 @@
* (or abusing) the cache (res) field, and the least significant bit of
* the hash next field (as a visited bit).
*/
-#define marked(n) (1 & (int)(n)->next)
-#define mark(n) ((n)->next = (node *)(1 | (int)(n)->next))
-#define clearmark(n) ((n)->next = (node *)(~1 & (int)(n)->next))
-#define clearmarkbit(p) ((node *)(~1 & (int)(p)))
+#define marked(n) (1 & (long)(n)->next)
+#define mark(n) ((n)->next = (node *)(1 | (long)(n)->next))
+#define clearmark(n) ((n)->next = (node *)(~1 & (long)(n)->next))
+#define clearmarkbit(p) ((node *)(~1 & (long)(p)))
/*
* Sometimes we want to use *res* instead of next to mark. You cannot
* do this to leaves, though.
*/
-#define marked2(n) (1 & (int)(n)->res)
-#define mark2(n) ((n)->res = (node *)(1 | (int)(n)->res))
-#define clearmark2(n) ((n)->res = (node *)(~1 & (int)(n)->res))
+#define marked2(n) (1 & (long)(n)->res)
+#define mark2(n) ((n)->res = (node *)(1 | (long)(n)->res))
+#define clearmark2(n) ((n)->res = (node *)(~1 & (long)(n)->res))
static void sum4(bigint &dest, const bigint &a, const bigint &b,
const bigint &c, const bigint &d) {
dest = a ;
@@ -1573,10 +1573,10 @@
return 0 ;
if (depth == 2) {
if (root->nw != 0)
- return (int)(root->nw) ;
+ return (long)(root->nw) ;
} else {
if (marked2(root))
- return (int)(root->next) ;
+ return (long)(root->next) ;
unhash_node(root) ;
mark2(root) ;
}
@@ -1621,10 +1621,10 @@
return 0 ;
if (depth == 2) {
if (root->nw != 0)
- return (int)(root->nw) ;
+ return (long)(root->nw) ;
} else {
if (marked2(root))
- return (int)(root->next) ;
+ return (long)(root->next) ;
unhash_node(root) ;
mark2(root) ;
}
@@ -1657,8 +1657,8 @@
if (root == zeronode(depth))
return 0 ;
if (depth == 2) {
- if (cellcounter + 1 != (int)(root->nw))
- return (int)(root->nw) ;
+ if (cellcounter + 1 != (long)(root->nw))
+ return (long)(root->nw) ;
thiscell = ++cellcounter ;
if ((cellcounter & 4095) == 0) {
unsigned long siz = ftell(f) ;
@@ -1683,16 +1683,16 @@
}
fputs("\n", f) ;
} else {
- if (cellcounter + 1 > (int)(root->next) || isaborted())
- return (int)(root->next) ;
+ if (cellcounter + 1 > (long)(root->next) || isaborted())
+ return (long)(root->next) ;
int nw = writecell_2p2(f, root->nw, depth-1) ;
int ne = writecell_2p2(f, root->ne, depth-1) ;
int sw = writecell_2p2(f, root->sw, depth-1) ;
int se = writecell_2p2(f, root->se, depth-1) ;
if (!isaborted() &&
- cellcounter + 1 != (int)(root->next)) { // this should never happen
+ cellcounter + 1 != (long)(root->next)) { // this should never happen
lifefatal("Internal in writecell_2p2") ;
- return (int)(root->next) ;
+ return (long)(root->next) ;
}
thiscell = ++cellcounter ;
if ((cellcounter & 4095) == 0) {
diff -uN golly-1.3/qlifealgo.cpp golly-1.3-amd64/qlifealgo.cpp
--- golly-1.3/qlifealgo.cpp 2007-01-08 14:40:31.000000000 +0100
+++ golly-1.3-amd64/qlifealgo.cpp 2008-03-09 15:18:44.000000000 +0100
@@ -75,10 +75,10 @@
lifefatal("No memory.") ;
r->next = memused ;
memused = r ;
- safep = p = (linkedmem *)((((int)(r+1))+i-1)&-i) ;
- while (((int)p) + 2 * size <= MEMCHUNK+(int)r) {
- p->next = (linkedmem *)(size + (int)p) ;
- p = (linkedmem *)(size + (int)p) ;
+ safep = p = (linkedmem *)((((long)(r+1))+i-1)&-i) ;
+ while (((long)p) + 2 * size <= MEMCHUNK+(long)r) {
+ p->next = (linkedmem *)(size + (long)p) ;
+ p = (linkedmem *)(size + (long)p) ;
}
return safep ;
}
@@ -211,7 +211,7 @@
* out as a 256x256 universe.
*/
qlifealgo::qlifealgo() {
- int test = (INT_MAX != 0x7fffffff || sizeof(int *) != sizeof(int)) ;
+ int test = (INT_MAX != 0x7fffffff || sizeof(int *) != sizeof(long)) ;
if (test)
lifefatal("bad platform for this program") ;
memused = 0 ;