EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Patch to compile crc32.cpp on GCC 3.3.x (https://www.eqemulator.org/forums/showthread.php?t=10968)

daeken_bb 12-23-2003 01:09 PM

Patch to compile crc32.cpp on GCC 3.3.x
 
Have fun:
Code:

--- common/crc32.old        Mon Dec 22 13:35:50 2003
+++ common/crc32.cpp        Mon Dec 22 13:30:41 2003
@@ -161,17 +161,15 @@
        return crc32;
 }
 #elif defined(i386)
-                register uint32  val __asm ( "ax" );
-                val = crc32;
 
 __asm __volatile (
                "xorl        %%ebx, %%ebx\n"
-                "movl        %1, %%esi\n"
-                "movl        %2, %%ecx\n"
+    "movl $crc32, %%eax\n"
+                "movl        %0, %%esi\n"
+                "movl        %1, %%ecx\n"
                "movl        $CRC32Table, %%edi\n"
-                "shrl        $2, %%ecx\n"
+                "shrl        $0, %%ecx\n"
                "jz        1f\n"
-
                ".align 4\n"
                "0:\n"
                "movb        %%al, %%bl\n"
@@ -203,7 +201,7 @@
                "jnz        0b\n"
 
                "1:\n"
-                "movl        %2, %%ecx\n"
+                "movl        %1, %%ecx\n"
                "andl        $3, %%ecx\n"
                "jz        2f\n"
 
@@ -229,11 +227,11 @@
                "xorl        (%%edi,%%ebx,4), %%eax\n"
        "2:\n"
                :
-                : "a" (val), "g" (buf), "g" (bufsize)
+                : "g" (buf), "g" (bufsize)
                : "ax", "bx", "cx", "dx", "si", "di"
        );
       
-        return val;
+        return crc32;
 }
 #else
        for(uint32 i=0; i < bufsize; i++)

Edit: Code tags - kathgar

var1ety 01-01-2004 03:49 PM

eh
 
Eh, patch doesn't work for me. Already talked to Daeken in IRC, so he's aware of it. Temporarily fix for people that have to use gcc 3.3.x is to comment out the offending ASM, and use the C code instead.

This would take the form of:

(Line 136ish)

/*
#elif defined(i386)
....
*/
#else
for(uint32 i=0; i < bufsize; i++)
...

DeletedUser 01-02-2004 11:28 PM

Could also just undefine i386, it's only used for triggering the crc32 asm code vs c++ code.


All times are GMT -4. The time now is 03:38 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.