Re: bitscan forward/reverse on Windows

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: bitscan forward/reverse on Windows
Date: 2023-02-08 08:14:08
Message-ID: CAFBsxsH_BbPUVeTA8rD8A0f1RaCTLN17i89v8yriNuouBnTzpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Attached is a quick-and-dirty attempt to add MSVC support for the
rightmost/leftmost-one-pos functions.
>
> 0001 adds asserts to the existing coding.
> 0002 adds MSVC support. Tests pass on CI, but it's of course possible
that there is some bug that prevents hitting the fastpath. I've mostly used
the platform specific types, so some further cleanup might be needed.

I've cleaned these up and verified on godbolt.org that they work as
intended and still pass CI. I kept the Windows types as does other Winows
code in the tree, but used bool instead of unsigned char because it's used
like a boolean.

0003 is separate because I'm not quite sure how detailed to comment the
#ifdef maze. Could be left out.
0004 simplifies AllocSetFreeIndex() in the course of supporting MSVC. The
output is identical to HEAD in non-assert builds using gcc.

0002 through 0004 could be squashed together.

This plugs a hole in our platform-specific intrinsic support and is fairly
straightforward. Review welcome, but if there is none I intend to commit in
a week or two.

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

Attachment Content-Type Size
v4-0003-Add-more-comments-to-else-directives.patch text/x-patch 1.6 KB
v4-0004-Rationalize-platform-support-in-AllocSetFreeIndex.patch text/x-patch 1.8 KB
v4-0002-Add-MSVC-support-for-bitscan-reverse-forward.patch text/x-patch 5.1 KB
v4-0001-Add-asserts-to-verify-bitscan-intrinsics.patch text/x-patch 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message o.tselebrovskiy 2023-02-08 08:21:03 A bug with ExecCheckPermissions
Previous Message Pavel Stehule 2023-02-08 08:07:27 Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID