Skip to content

Commit

Permalink
Fix: Initializing basic_charset
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Dec 9, 2024
1 parent 660923e commit 864ee03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/stringzilla/stringzilla.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class basic_charset {
template <std::size_t count_characters>
explicit basic_charset(char_type const (&chars)[count_characters]) noexcept : basic_charset() {
static_assert(count_characters > 0, "Character array cannot be empty");
for (std::size_t i = 0; i < count_characters - 1; ++i) { // count_characters - 1 to exclude the null terminator
for (std::size_t i = 0; i != count_characters; ++i) {
char_type c = chars[i];
bitset_._u64s[sz_bitcast(sz_u8_t, c) >> 6] |= (1ull << (sz_bitcast(sz_u8_t, c) & 63u));
}
Expand All @@ -292,7 +292,7 @@ class basic_charset {
template <std::size_t count_characters>
explicit basic_charset(std::array<char_type, count_characters> const &chars) noexcept : basic_charset() {
static_assert(count_characters > 0, "Character array cannot be empty");
for (std::size_t i = 0; i < count_characters - 1; ++i) { // count_characters - 1 to exclude the null terminator
for (std::size_t i = 0; i != count_characters; ++i) {
char_type c = chars[i];
bitset_._u64s[sz_bitcast(sz_u8_t, c) >> 6] |= (1ull << (sz_bitcast(sz_u8_t, c) & 63u));
}
Expand Down

0 comments on commit 864ee03

Please sign in to comment.