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

Add support for 32bit systems by falling back to std::unordered_map #56

Merged
merged 1 commit into from
May 27, 2024
Merged
Changes from all commits
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
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