A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029580.html below:

[Python-Dev] Memory size overflows

[Python-Dev] Memory size overflows [Python-Dev] Memory size overflowsGuido van Rossum guido@python.org
Tue, 15 Oct 2002 00:24:56 -0400
I think this discussion is suffering from the desire to
over-generalize.

Armin, can you show us how to multiply two nonnegative ints together
with an overflow "block" as Tim suggested earlier?  I.e. a macro
callable as

  SAFE_MULTIPLY(destination, src1, src2, on_overflow);

meaning roughly

  destination = src1 * src2;
  if (<overflow detected>)
     on_overflow;

I currently use something like this as the overflow test in a few places:

  if (src1 && destination / src1 != src2)

but as Tim points out the division can kill us unless src1 is a
constant...  How would you spell this without doing a division?

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4