Boost logo

Boost :

From: Ulrich Eckhardt (doomster_at_[hidden])
Date: 2007-06-26 00:14:19


This is basically the result of a discussion on the STLport mailinglist. The
question came up what this code means:

#if defined(_BIG_ENDIAN)
   0x7f80 << (sizeof(int)*CHAR_BIT-16),

This is from detail/limits.hpp. The puzzling thing is that the result for
big-endian targets is exactly the same, unless the size of an int is not 32
bit, but the size of the int has nothing to do with endianess still...

I dug around a bit, and it was added some time ago by John Maddock with the
comment that it adds support for big-endian SPARC machines, but later also
used for big-endian MIPS and PPC. There also used to be a comment saying
something like: "making this depend on big-endian targets is wrong, it's the
layout of floats we care about, not the layout of integers when written to
memory". This comment was removed when the ad-hoc endian detection was
replaced with the centralized one.

Can anybody see what this code is supposed to do? I understand that 0x7f800000
is an integer with the same bit layout as one of the special floating point
constants, but I can't figure out why it would be any different on big-endian


Boost list run by bdawes at, gregod at, cpdaniel at, john at