Skip to content

Commit

Permalink
Rename BIG_ENDIAN to IS_BIG_ENDIAN
Browse files Browse the repository at this point in the history
The BIG_ENDIAN macro is a system level macro that is always defined in C++
  • Loading branch information
kimwalisch committed Mar 14, 2018
1 parent ed9a1aa commit 20972c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ check_cxx_source_runs("
bool is_big_endian = (x.c[sizeof(long) - 1] == 1);
return is_big_endian ? 0 : 1;
}"
big_endian)
big_endian)

if(big_endian)
set_source_files_properties(src/Sieve.cpp PROPERTIES COMPILE_DEFINITIONS BIG_ENDIAN)
set_source_files_properties(src/Sieve.cpp PROPERTIES COMPILE_DEFINITIONS IS_BIG_ENDIAN)
endif()

# Check for MPI (Message Passing Interface) ##########################
Expand Down
12 changes: 8 additions & 4 deletions include/SieveEndianness.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

namespace {

#if defined(BIG_ENDIAN) || \
(defined(__BYTE_ORDER__) && \
defined(__ORDER_BIG_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
#undef IS_BIG_ENDIAN
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define IS_BIG_ENDIAN
#endif
#endif

#if defined(IS_BIG_ENDIAN)

/// The values of the big-endian lookup tables have been computed by
/// converting the values of the little-endian lookup tables to
Expand Down

0 comments on commit 20972c3

Please sign in to comment.