
On Tuesday 16 December 2008 16:17:10 David Abrahams wrote:
on Tue Dec 16 2008, "Giovanni Piero Deretta" <gpderetta-AT-gmail.com> wrote:
On Tue, Dec 16, 2008 at 3:03 PM, Pyry Jahkola <pyry.jahkola@gmail.com> wrote:
Gevorg Voskanyan wrote:
I suggest modifying CastFloatIter() function to use memcpy for accessing floats as integers, as shown below:
Hmm, I don't think it's any better than reinterpret casting.
Yes it is. It has the nice property of not leading to UB.
If so, that surprises me. Is it really guaranteed that all valid floating-point bit patterns are also valid integer bit patterns?
Not true; I am aware of at least one embedded platform where int is 24 bits whereas float on the same platform is 32 bits. As far as I can tell, the port of gcc that is used on this platform works fine for C; don't know about C++. Regards, Ravi