Skip to content

Commit

Permalink
Merge pull request #56 from juntyr/32bit-hash
Browse files Browse the repository at this point in the history
Add support for 32bit systems by falling back to `std::unordered_map`
  • Loading branch information
ayzk authored May 27, 2024
2 parents f8fc2cb + e52a2c3 commit 3f47817
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/SZ3/encoder/HuffmanEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#include "SZ3/utils/ByteUtil.hpp"
#include "SZ3/utils/MemoryUtil.hpp"
#include "SZ3/utils/Timer.hpp"
#include "SZ3/utils/ska_hash/unordered_map.hpp"
#include <cstdint>
#if INTPTR_MAX == INT64_MAX // 64bit system
#include "SZ3/utils/ska_hash/unordered_map.hpp"
#endif // INTPTR_MAX == INT64_MAX
#include <cassert>
#include <cstdlib>
#include <cstring>
Expand Down Expand Up @@ -525,7 +528,12 @@ namespace SZ3 {
T max = s[0];
offset = s[0]; //offset is min

ska::unordered_map<T, size_t> frequency;
#if INTPTR_MAX == INT64_MAX // 64bit system
ska::unordered_map<T, size_t> frequency;
#else // most likely 32bit system
std::unordered_map<T, size_t> frequency;
#endif // INTPTR_MAX == INT64_MAX

for (size_t i = 0; i < length; i++) {
frequency[s[i]]++;
}
Expand Down

0 comments on commit 3f47817

Please sign in to comment.