This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-18 21:41 -------
This is not a bug as signbit just have to return a non zero value if it has the value passed has its sign 
bit set.
So defining it this way:
inline int mysignbit(float x) {
  union { float f; unsigned int i; } u;
  u.f = x;
  return u.i&0x80000000UL;
}

Is also legal.

The reason for the different is optimizing for size vs optimizing for speed.  The definition you gave is 
faster but larger.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23469


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