Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix predefines for bswap for old compilers #99

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions include/aws/checksums/private/crc_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ static inline uint32_t aws_bswap32_if_be(uint32_t x) {

#if _MSC_VER
return _byteswap_ulong(x);
#elif defined(__GNUC__) || defined(__clang__)
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
waahm7 marked this conversation as resolved.
Show resolved Hide resolved
return __builtin_bswap32(x);
#elif defined(__clang__) && __clang_major__ >= 3
return __builtin_bswap32(x);
#else
return (
Expand All @@ -47,7 +49,9 @@ static inline uint64_t aws_bswap64_if_be(uint64_t x) {

#if _MSC_VER
return _byteswap_uint64(x);
#elif defined(__GNUC__) || defined(__clang__)
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
return __builtin_bswap64(x);
#elif defined(__clang__) && __clang_major__ >= 3
return __builtin_bswap64(x);
#else
return ((x << 56) & 0xff00000000000000ULL) | ((x << 40) & 0x00ff000000000000ULL) |
Expand Down