Re: pgsql: Extend & revamp pg_bswap.h infrastructure.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Extend & revamp pg_bswap.h infrastructure.
Date: 2017-09-30 00:33:51
Message-ID: CAH2-Wz=at5AOzb=P=Z5g4OHQ4o5EjyDWdwsr+Y4Sqt2siQ1v2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Fri, Sep 29, 2017 at 5:29 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Extend & revamp pg_bswap.h infrastructure.

This looks wrong:

+static inline uint16
+pg_bswap64(uint16 x)
+{
+ return
+ ((x << 56) & UINT64CONST(0xff00000000000000)) |
+ ((x << 40) & UINT64CONST(0x00ff000000000000)) |
+ ((x << 24) & UINT64CONST(0x0000ff0000000000)) |
+ ((x << 8) & UINT64CONST(0x000000ff00000000)) |
+ ((x >> 8) & UINT64CONST(0x00000000ff000000)) |
+ ((x >> 24) & UINT64CONST(0x0000000000ff0000)) |
+ ((x >> 40) & UINT64CONST(0x000000000000ff00)) |
+ ((x >> 56) & UINT64CONST(0x00000000000000ff));
+}

--
Peter Geoghegan

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-09-30 00:36:40 Re: pgsql: Extend & revamp pg_bswap.h infrastructure.
Previous Message Andres Freund 2017-09-30 00:29:57 pgsql: Fix typo.