Skip to content
Newer
Older
100644 31 lines (28 sloc) 1.52 KB
04d2905 add safe_emalloc
Sascha Schumann authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
29ee03a @andigutmans - Apply Ard's patch to support multiplication & overflow on both 32bit
andigutmans authored
5 | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
04d2905 add safe_emalloc
Sascha Schumann authored
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
04d2905 add safe_emalloc
Sascha Schumann authored
10 | http://www.zend.com/license/2_00.txt. |
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
29ee03a @andigutmans - Apply Ard's patch to support multiplication & overflow on both 32bit
andigutmans authored
15 | Author: Ard Biesheuvel <ard@ard.nu> |
04d2905 add safe_emalloc
Sascha Schumann authored
16 +----------------------------------------------------------------------+
17 */
18
d0bfc13 - Missing $Id$ tag
foobar authored
19 /* $Id$ */
20
29ee03a @andigutmans - Apply Ard's patch to support multiplication & overflow on both 32bit
andigutmans authored
21 #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
cedd029 @andigutmans - Improved patch for support multiplication on 64bit machines
andigutmans authored
22 long __lres = (a) * (b); \
23 double __dres = (double)(a) * (double)(b); \
24 double __delta = (double) __lres - __dres; \
25 if ( ((usedval) = (( __dres + __delta ) != __dres))) { \
26 (dval) = __dres; \
29ee03a @andigutmans - Apply Ard's patch to support multiplication & overflow on both 32bit
andigutmans authored
27 } else { \
cedd029 @andigutmans - Improved patch for support multiplication on 64bit machines
andigutmans authored
28 (lval) = __lres; \
29ee03a @andigutmans - Apply Ard's patch to support multiplication & overflow on both 32bit
andigutmans authored
29 } \
04d2905 add safe_emalloc
Sascha Schumann authored
30 } while (0)
Something went wrong with that request. Please try again.