Re: [COMMITTERS] pgsql: Extend & revamp pg_bswap.h infrastructure. - Mailing list pgsql-committers

From Peter Geoghegan
Subject Re: [COMMITTERS] pgsql: Extend & revamp pg_bswap.h infrastructure.
Date
Msg-id CAH2-Wz=at5AOzb=P=Z5g4OHQ4o5EjyDWdwsr+Y4Sqt2siQ1v2g@mail.gmail.com
Whole thread Raw
In response to [COMMITTERS] pgsql: Extend & revamp pg_bswap.h infrastructure.  (Andres Freund <andres@anarazel.de>)
Responses Re: [COMMITTERS] pgsql: Extend & revamp pg_bswap.h infrastructure.  (Andres Freund <andres@anarazel.de>)
List pgsql-committers
On Fri, Sep 29, 2017 at 5:29 PM, Andres Freund <andres@anarazel.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


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: [COMMITTERS] pgsql: Extend & revamp pg_bswap.h infrastructure.
Next
From: Andres Freund
Date:
Subject: Re: [COMMITTERS] pgsql: Extend & revamp pg_bswap.h infrastructure.