This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Aug 2005 21:41:12 -0000
- Subject: [Bug other/23469] Behaviour of built-in __signbitf(x) differs with optimization
- References: <20050818204303.23469.ddneilson@gmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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