signed_multiply_long
| From: | Sascha Schumann | Date: | Wed, 02 Apr 2003 08:52:42 +0000 |
| Subject: | signed_multiply_long | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-596@lists.php.net to get a copy of this message | ||
The attached source presents a multiplication routine with
built-in overflow detection. For x86/GCC, we can avoid
floating point arithmetic by using a small assembler
fragment. Support for other platforms can be added as
necessary.
There are two distinct uses for this in PHP:
- the engine needs to verify whether the result of a
integer multiplication fits into its integral type
(script context)
- the memory allocator has to ensure that no integer
overflows happen
Your input is appreciated.
- Sascha