Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Include/internal/pycore_bitutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif

#if defined(__clang__) || \
(defined(__GNUC__) && \
((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)))
/* __builtin_bswap16() is available since GCC 4.8,
#if ((defined(__GNUC__) \
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))) \
|| (defined(__clang__) \
&& (__clang_major__ >= 4 \
|| (__clang_major__ == 3 && __clang_minor__ >= 2))))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this does not work correctly with Apple's clang, which uses a different versioning scheme. Probably the fix in #21949 should be used instead.

/* __builtin_bswap16() is available since GCC 4.8 and clang 3.2,
__builtin_bswap32() is available since GCC 4.3,
__builtin_bswap64() is available since GCC 4.3. */
# define _PY_HAVE_BUILTIN_BSWAP
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix ``pycore_bitutils.h`` header file to support old clang versions:
``__builtin_bswap16()`` is not available in LLVM clang 3.0.