[RFC] Saturating using arithmetic in address calculation.

Paul Eggert eggert@cs.ucla.edu
Sat Oct 26 19:27:00 GMT 2013


Ondřej Bílka wrote:
> After pondering that a bit I come to that what is really needed is
> computing size in saturated arithmetic.

Yes, that's the convention used in parts of gnulib.
SIZE_MAX means "the size calculation overflowed",
and the assumption is that malloc (SIZE_MAX) fails.

We don't attempt to optimize this at the machine
code level, as the small improvement in performance
isn't worth the portability hassle for us; but it might
be worth doing in glibc.



More information about the Libc-alpha mailing list