signed_multiply_long

php.internals

Sascha Schumann

23 years ago
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