Skip to content

Commit 1047b89

Browse files
committed
chore: just export whats needed in xxh3
1 parent b477019 commit 1047b89

2 files changed

Lines changed: 7 additions & 16 deletions

File tree

src/main.cpp2

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,7 @@ hash_file: (p: fs::path) -> u64 = {
765765
buffer.resize(size);
766766
f.read(buffer.data(), size);
767767
if f.fail() { return 0; }
768-
return constexpr_xxh3::XXH3_64bits(buffer.data(), buffer.size());
769-
}
770-
771-
cpp2b_data_file: type = {
768+
return XXH3_64bits(buffer.data(), buffer.size());
772769
}
773770

774771
do_build: (targets: std::vector<std::string>) -> (stuff: full_build_info, exit_code: int) = {
@@ -831,7 +828,6 @@ do_build: (targets: std::vector<std::string>) -> (stuff: full_build_info, exit_c
831828
transpile_futures: std::vector<std::future<transpile_cpp2_result>> = ();
832829
cpp2b_parse_futures: std::vector<std::future<cpp2b_source_info>> = ();
833830
file_hash_futures: std::unordered_map<fs::path, std::future<u64>> = ();
834-
file_hash_futures: std::unordered_map<fs::path, std::future<u64>> = ();
835831

836832
transpile_futures.reserve(cpp2_source_files.size());
837833
cpp2b_parse_futures.reserve(cpp2_source_files.size());

src/xxh3.cppm

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ module;
5151

5252
export module xxh3;
5353

54-
export namespace constexpr_xxh3 {
55-
5654
template <typename T>
5755
concept ByteType = (std::is_integral_v<T> && sizeof(T) == 1)
5856
#if defined __cpp_lib_byte && __cpp_lib_byte >= 201603
@@ -300,7 +298,7 @@ constexpr size_t bytes_size(T (&)[N]) noexcept {
300298

301299
/// Basic interfaces
302300

303-
template <ByteType T>
301+
export template <ByteType T>
304302
constexpr uint64_t XXH3_64bits(const T* input, size_t len) noexcept {
305303
return XXH3_64bits_internal(
306304
input, len, 0, kSecret, sizeof(kSecret),
@@ -310,7 +308,7 @@ constexpr uint64_t XXH3_64bits(const T* input, size_t len) noexcept {
310308
});
311309
}
312310

313-
template <ByteType T, ByteType S>
311+
export template <ByteType T, ByteType S>
314312
constexpr uint64_t XXH3_64bits_withSecret(const T* input, size_t len,
315313
const S* secret,
316314
size_t secretSize) noexcept {
@@ -322,7 +320,7 @@ constexpr uint64_t XXH3_64bits_withSecret(const T* input, size_t len,
322320
});
323321
}
324322

325-
template <ByteType T>
323+
export template <ByteType T>
326324
constexpr uint64_t XXH3_64bits_withSeed(const T* input, size_t len,
327325
uint64_t seed) noexcept {
328326
if (seed == 0) return XXH3_64bits(input, len);
@@ -341,24 +339,21 @@ constexpr uint64_t XXH3_64bits_withSeed(const T* input, size_t len,
341339

342340
/// Convenient interfaces
343341

344-
template <BytesType Bytes>
342+
export template <BytesType Bytes>
345343
constexpr uint64_t XXH3_64bits(const Bytes& input) noexcept {
346344
return XXH3_64bits(std::data(input), bytes_size(input));
347345
}
348346

349-
template <BytesType Bytes, BytesType Secret>
347+
export template <BytesType Bytes, BytesType Secret>
350348
constexpr uint64_t XXH3_64bits_withSecret(const Bytes& input,
351349
const Secret& secret) noexcept {
352350
return XXH3_64bits_withSecret(std::data(input), bytes_size(input),
353351
std::data(secret), bytes_size(secret));
354352
}
355353

356-
template <BytesType Bytes>
354+
export template <BytesType Bytes>
357355
constexpr uint64_t XXH3_64bits_withSeed(const Bytes& input,
358356
uint64_t seed) noexcept {
359357
return XXH3_64bits_withSeed(std::data(input), bytes_size(input), seed);
360358
}
361359

362-
} // namespace constexpr_xxh3
363-
364-

0 commit comments

Comments
 (0)