Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 53ea2b7

Browse files
committed
Don't use _BitScanForward64/_BitScanReverse64 on 32-bit MSVC builds
6773197 added support for making use of MSVC's bit scanning functions. However, that commit failed to consider 32-bit MSVC builds where the 64-bit versions of these functions are unavailable. This resulted in compilation failures on 32-bit MSVC. Here we adjust the code so we fall back on the manual way of finding the bit positions for 64-bit integers when building on 32-bit MSVC. Bug: #17967 Reported-by: Youmiu Mo Discussion: https://postgr.es/m/17967-cd21e34a314141b2@postgresql.org
1 parent f245236 commit 53ea2b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/include/port/pg_bitutils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pg_leftmost_one_pos64(uint64 word)
8181
#error must have a working 64-bit integer datatype
8282
#endif /* HAVE_LONG_INT_64 */
8383

84-
#elif defined(_MSC_VER)
84+
#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64))
8585
unsigned long result;
8686
bool non_zero;
8787

@@ -152,7 +152,7 @@ pg_rightmost_one_pos64(uint64 word)
152152
#error must have a working 64-bit integer datatype
153153
#endif /* HAVE_LONG_INT_64 */
154154

155-
#elif defined(_MSC_VER)
155+
#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64))
156156
unsigned long result;
157157
bool non_zero;
158158

0 commit comments

Comments
 (0)