This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: abs function question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]