This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: abs function question
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Steve Ellcey <sje at cup dot hp dot com>
- Cc: rittle at latour dot rsch dot comm dot mot dot com, libstdc++ at gcc dot gnu dot org
- Date: 29 Jul 2003 19:00:23 +0200
- Subject: Re: abs function question
- Organization: Integrable Solutions
- References: <200307291634.JAA03285@hpsje.cup.hp.com>
Steve Ellcey <sje@cup.hp.com> writes:
| I think part of my argument is still valid for some systems though,
| wouldn't:
|
| namespace std {
| inline int abs(int __i) { return __i >= 0 ? __i : -__i; }
| inline long abs(long __i) { return __i >= 0 ? __i : -__i; }
| }
|
| be more efficient then:
Your argument is missing the fact -- for the int version -- we need to
ensure the invariant
&::abs == &std::abs
As of long abs(long), we could make it a forward to __builtin_xxx.
-- Gaby