Re: use rotate macro in more places

2022-02-19 Thread John Naylor
On Sun, Feb 20, 2022 at 1:03 AM Yugo NAGATA wrote: > I think we can use this macro also in hash_multirange, hash_range, > and JsonbHashScalarValue as in the attached patch. How about replacing > them with the macro, too. Good find. I also found one more in hashfn.c. On Sat, Feb 19, 2022 at 11:28

Re: use rotate macro in more places

2022-02-19 Thread Tom Lane
Yugo NAGATA writes: > For avoiding undefined behaviours, maybe it is better to use unsigned > int and bit mask as a following code in Linux does[1][2], though it > would be unnecessary if they are used properly as in the current > PostgreSQL code. I don't think that's an improvement. It would m

Re: use rotate macro in more places

2022-02-19 Thread Yugo NAGATA
On Sat, 19 Feb 2022 20:07:58 +0700 John Naylor wrote: > 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

Re: use rotate macro in more places

2022-02-19 Thread Tom Lane
John Naylor writes: > 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

use rotate macro in more places

2022-02-19 Thread John Naylor
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