summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorjmc <jmc@pkgsrc.org>2002-04-04 19:28:10 +0000
committerjmc <jmc@pkgsrc.org>2002-04-04 19:28:10 +0000
commit89338eebd6aad55c62d0f36f805fba72aeb9e720 (patch)
tree87b54489a5d1db09d0142532167cbd8067a02869 /games
parentc4556bac9f923a36ee1bf3b921e41200010d82aa (diff)
downloadpkgsrc-89338eebd6aad55c62d0f36f805fba72aeb9e720.tar.gz
Provide a FirstOne and LastOne implemention for archs without hand crafted
assembly substitutes.
Diffstat (limited to 'games')
-rw-r--r--games/crafty/distinfo3
-rw-r--r--games/crafty/patches/patch-ab67
2 files changed, 69 insertions, 1 deletions
diff --git a/games/crafty/distinfo b/games/crafty/distinfo
index 080694cabfd..9a806ea356d 100644
--- a/games/crafty/distinfo
+++ b/games/crafty/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2002/01/12 05:48:15 jlam Exp $
+$NetBSD: distinfo,v 1.6 2002/04/04 19:28:10 jmc Exp $
SHA1 (crafty-18.13/crafty-18.13.tar.gz) = 9ec43d2c629eaa6bbb0df53b719764487a9d2be2
Size (crafty-18.13/crafty-18.13.tar.gz) = 363916 bytes
@@ -9,3 +9,4 @@ Size (crafty-18.13/read.me) = 6942 bytes
SHA1 (crafty-18.13/crafty.faq) = 7ba5cc19e190fdcf1697e3130c679ce5e50141db
Size (crafty-18.13/crafty.faq) = 10252 bytes
SHA1 (patch-aa) = 7e6306d7ba0cc1ac6159c717328bd172785326f1
+SHA1 (patch-ab) = f25fba723d970a04811481947715dfeaf97a988f
diff --git a/games/crafty/patches/patch-ab b/games/crafty/patches/patch-ab
new file mode 100644
index 00000000000..9277af05ed2
--- /dev/null
+++ b/games/crafty/patches/patch-ab
@@ -0,0 +1,67 @@
+$NetBSD: patch-ab,v 1.3 2002/04/04 19:28:10 jmc Exp $
+
+--- boolean.c.orig Thu Apr 4 07:18:52 2002
++++ boolean.c Thu Apr 4 19:19:16 2002
+@@ -61,23 +61,49 @@
+ }
+
+ int FirstOne(BITBOARD arg1) {
++ unsigned int i, j, k;
++
++ j = k = 0;
+ if (arg1>>48)
+- return (first_ones[arg1>>48]);
+- if ((arg1>>32)&65535)
+- return (first_ones[(arg1>>32)&65535]+16);
+- if ((arg1>>16)&65535)
+- return (first_ones[(arg1>>16)&65535]+32);
+- return (first_ones[arg1&65535]+48);
++ i = ((BITBOARD)(arg1>>48));
++ else if ((arg1>>32)&65535) {
++ i = ((arg1>>32)&65535);
++ j = 16;
++ } else if ((arg1>>16)&65535) {
++ i = (arg1>>16)&65535;
++ j = 32;
++ } else {
++ i = arg1&65535;
++ j = 48;
++ }
++ while (i >>= 1)
++ k++;
++ k = 16 - k;
++ return (j + k - 1);
+ }
+
+ int LastOne(BITBOARD arg1) {
+- if (arg1&65535)
+- return (last_ones[arg1&65535]+48);
+- if ((arg1>>16)&65535)
+- return (last_ones[(arg1>>16)&65535]+32);
+- if ((arg1>>32)&65535)
+- return (last_ones[(arg1>>32)&65535]+16);
+- return (last_ones[arg1>>48]);
++ unsigned int i,j,k;
++
++ j = k = 0;
++ if (arg1&65535) {
++ i = arg1&65535;
++ j = 48;
++ } else if ((arg1>>16)&65535) {
++ i = (arg1>>16)&65535;
++ j = 32;
++ } else if ((arg1>>32)&65535) {
++ i = (arg1>>32)&65535;
++ j = 16;
++ } else
++ i = arg1>>48;
++
++ while ((i & 0x1) == 0) {
++ i >>= 1;
++ k++;
++ }
++ k = 16 - k;
++ return j + k - 1;
+ }
+ #endif
+ #endif