# signed_multiply_long

- Thread: https://externals.io/message/596
- Original archive: https://news-web.php.net/php.internals/596
- Started by Sascha Schumann on 2003-04-02T08:52:42+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #596 — Sascha Schumann — 2003-04-02T08:52:42+00:00

URL: https://externals.io/message/596#596

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
