use rotate macro in more places - Mailing list pgsql-hackers

From John Naylor
Subject use rotate macro in more places
Date
Msg-id CAFBsxsH7c1LC0CGZ0ADCBXLHU5-=KNXx-r7tHYPAW51b2HK4Qw@mail.gmail.com
Whole thread Raw
Responses Re: use rotate macro in more places
Re: use rotate macro in more places
List pgsql-hackers
We've accumulated a few bit-twiddling hacks to get the compiler to
emit a rotate instruction. Since we have a macro for that, let's use
it, as in the attached. I thought the new call sites would look better
with a "left" version, so I added a new macro for that. That's not
necessary, however.

Some comments now look a bit too obvious to keep around, but maybe
they should be replaced with a "why", instead of a "what":

                        /* rotate hashkey left 1 bit at each step */
-                       hashkey = (hashkey << 1) | ((hashkey &
0x80000000) ? 1 : 0);
+                       hashkey = pg_rotate_left32(hashkey, 1);


-- 
John Naylor
EDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Design of pg_stat_subscription_workers vs pgstats
Next
From: Zhihong Yu
Date:
Subject: doc: join state for merge join