]> granicus.if.org Git - php/commitdiff
Readd x86 implementation
authorSascha Schumann <sas@php.net>
Wed, 17 Mar 2004 22:23:15 +0000 (22:23 +0000)
committerSascha Schumann <sas@php.net>
Wed, 17 Mar 2004 22:23:15 +0000 (22:23 +0000)
Zend/zend_multiply.h

index 81851b6f24fa735384cf6f6b49ede0ff9a49dda7..7570572cc0a71cf6f088190545432601eaeeb1fb 100644 (file)
    | obtain it through the world-wide-web, please send a note to          |
    | license@zend.com so we can mail you a copy immediately.              |
    +----------------------------------------------------------------------+
-   | Author: Ard Biesheuvel <ard@ard.nu>                                  |
+   | Authors: Sascha Schumann <sascha@schumann.cx>                        |
+   |          Ard Biesheuvel <ard@ard.nu>                                 |
    +----------------------------------------------------------------------+
 */
 
 /* $Id$ */
 
+#if defined(__i386__) && defined(__GNUC__)
+
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do {      \
+       long __tmpvar;                                                                                                  \
+       __asm__ ("imul %3,%0\n"                                                                                 \
+               "adc $0,%1"                                                                                             \
+                       : "=r"(__tmpvar),"=r"(usedval)                                                  \
+                       : "0"(a), "r"(b), "1"(0));                                                              \
+       if (usedval) (dval) = (double) (a) * (double) (b);                              \
+       else (lval) = __tmpvar;                                                                                 \
+} while (0)
+
+#else
+
 #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do {              \
        long   __lres  = (a) * (b);                                                                                     \
        double __dres  = (double)(a) * (double)(b);                                                     \
@@ -28,3 +43,5 @@
                (lval) = __lres;                                                                                                \
        }                                                                                                                                       \
 } while (0)
+
+#endif