summaryrefslogtreecommitdiff
path: root/Zend/zend_multiply.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-07-24 13:46:48 +0000
committerDmitry Stogov <dmitry@php.net>2008-07-24 13:46:48 +0000
commit0c77613d776a9236da401b3553f48b6d5a4c72b3 (patch)
tree8a6499e08bb139ae36d95f7d5ef9756c554fbf59 /Zend/zend_multiply.h
parent33be49a588c305a7e3db66e2f1fe30d6543731b6 (diff)
downloadphp-git-0c77613d776a9236da401b3553f48b6d5a4c72b3.tar.gz
Optimized ZEND_SIGNED_MULTIPLY_LONG() (Matt)
Diffstat (limited to 'Zend/zend_multiply.h')
-rw-r--r--Zend/zend_multiply.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h
index 0fe9eeba20..8f5f03d70e 100644
--- a/Zend/zend_multiply.h
+++ b/Zend/zend_multiply.h
@@ -31,6 +31,19 @@
else (lval) = __tmpvar; \
} while (0)
+#elif SIZEOF_LONG == 4 && defined(HAVE_ZEND_LONG64)
+
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ zend_long64 __result = (zend_long64) (a) * (zend_long64) (b); \
+ if (__result > LONG_MAX || __result < LONG_MIN) { \
+ (dval) = (double) __result; \
+ (usedval) = 1; \
+ } else { \
+ (lval) = (long) __result; \
+ (usedval) = 0; \
+ } \
+} while (0)
+
#else
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \