diff --git a/core/base/mtx_io.cpp b/core/base/mtx_io.cpp index be338a602e4..7dada4e06a6 100644 --- a/core/base/mtx_io.cpp +++ b/core/base/mtx_io.cpp @@ -781,16 +781,16 @@ static constexpr uint64_t binary_format_magic() constexpr auto index_bit = is_int ? 'I' : 'L'; constexpr auto value_bit = is_double ? 'D' : (is_float ? 'S' : (is_complex_double ? 'Z' : 'C')); - constexpr uint64 type_bits = index_bit * 256ull + value_bit; + constexpr uint64 shift = 256; + constexpr uint64 type_bits = index_bit * shift + value_bit; return 'G' + - 256ull * + shift * ('I' + - 256ull * + shift * ('N' + - 256ull * + shift * ('K' + - 256ull * - ('G' + 256ull * ('O' + 256ull * type_bits))))); + shift * ('G' + shift * ('O' + shift * type_bits))))); } diff --git a/core/test/base/mtx_io.cpp b/core/test/base/mtx_io.cpp index 5c42225cdd2..57ab8d5d3ee 100644 --- a/core/test/base/mtx_io.cpp +++ b/core/test/base/mtx_io.cpp @@ -404,17 +404,17 @@ std::array build_binary_complex_data() double neg_dbl_val = -2.5; std::memcpy(&int_val, &dbl_val, sizeof(double)); std::memcpy(&neg_int_val, &neg_dbl_val, sizeof(double)); + constexpr gko::uint64 shift = 256; std::array data{ - 'G' + 256ull * + 'G' + shift * ('I' + - 256ull * + shift * ('N' + - 256ull * + shift * ('K' + - 256ull * - ('G' + - 256ull * - ('O' + 256ull * ('Z' + 256ull * 'L')))))), + shift * ('G' + + shift * ('O' + + shift * ('Z' + shift * 'L')))))), 64, // num_rows 32, // num_cols 4, // num_entries @@ -446,17 +446,17 @@ std::array build_binary_real_data() double neg_dbl_val = -2.5; std::memcpy(&int_val, &dbl_val, sizeof(double)); std::memcpy(&neg_int_val, &neg_dbl_val, sizeof(double)); + constexpr gko::uint64 shift = 256; std::array data{ - 'G' + 256ull * + 'G' + shift * ('I' + - 256ull * + shift * ('N' + - 256ull * + shift * ('K' + - 256ull * - ('G' + - 256ull * - ('O' + 256ull * ('D' + 256ull * 'L')))))), + shift * ('G' + + shift * ('O' + + shift * ('D' + shift * 'L')))))), 64, // num_rows 32, // num_cols 4, // num_entries