Skip to content

Commit

Permalink
review updates
Browse files Browse the repository at this point in the history
Co-authored-by: Yuhsiang Tsai <yhmtsai@gmail.com>
  • Loading branch information
upsj and yhmtsai committed Mar 10, 2022
1 parent 27f45e6 commit af9a074
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions core/base/mtx_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))));
}


Expand Down
28 changes: 14 additions & 14 deletions core/test/base/mtx_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,17 @@ std::array<gko::uint64, 20> 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<gko::uint64, 20> 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
Expand Down Expand Up @@ -446,17 +446,17 @@ std::array<gko::uint64, 16> 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<gko::uint64, 16> 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
Expand Down

0 comments on commit af9a074

Please sign in to comment.