On Thu, Oct 8, 2015 at 11:37 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> I'm not convinced. Doesn't this exact same concept get used for
> over-the-wire communication between BE and LE machines? There, this
> operation is spelled htonl/ntohl. Some systems even have htonll, but
> I'm sure there are still a bunch that don't.
I continue to disagree with that. The spelling of the macro that you
propose suggests that this process occurs at a relatively high level
of abstraction, which is misleading. Datums that have abbreviated key
bytes packed into them are in general kind of special. All the same,
here is a revision of the patch series along those lines. I'll also
have to update the UUID patch to independently note the same issues.
I should point out that I did not call the macro DatumToBigEndian(),
because it's actually the other way around. I called it
DatumToLittleEndian(), since the unsigned integer comparator would
work correctly on big-endian systems without calling any new macro
(which is of course why the new macro does nothing on big-endian
systems). We start off with a big endian Datum/unsigned integer on all
platforms, and then we byteswap it to make it a little-endian unsigned
integer if and when that's required (i.e. only on little-endian
systems).
--
Peter Geoghegan