This is the mail archive of the
mailing list for the glibc project.
Re: [RFC] Saturating using arithmetic in address calculation.
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Sat, 26 Oct 2013 12:27:23 -0700
- Subject: Re: [RFC] Saturating using arithmetic in address calculation.
- Authentication-results: sourceware.org; auth=none
- References: <20131025084008 dot GA17443 at domone> <526A319B dot 80909 at suse dot com> <Pine dot LNX dot 4 dot 64 dot 1310251530510 dot 12877 at digraph dot polyomino dot org dot uk> <526A92D7 dot 6040501 at cs dot ucla dot edu> <20131026150755 dot GA20393 at domone dot podge>
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.