[Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Aug 18 22:14:00 GMT 2005
------- 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
More information about the Gcc-bugs
mailing list