Skip to content

Commit

Permalink
Clean up some attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeaye committed Dec 30, 2023
1 parent 72f3e38 commit 66c2b2c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/cpp/jank/native_persistent_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ namespace jank
{ destroy(); }

/*** Data accessors. ***/
[[gnu::always_inline, gnu::flatten, gnu::hot, gnu::const]]
[[gnu::const]]
constexpr native_bool empty() const noexcept
{ return size() == 0; }

[[gnu::always_inline, gnu::flatten, gnu::hot, gnu::const]]
[[gnu::const]]
constexpr size_type size() const noexcept
{ return (get_category() == category::small) ? get_small_size() : store.large.size; }

/* XXX: The contents returned, for large shared strings, may not be null-terminated. If
* you require that, use c_str(). Whenever possible, use data() and size(). */
[[gnu::always_inline, gnu::flatten, gnu::hot, gnu::returns_nonnull, gnu::const]]
[[gnu::returns_nonnull, gnu::const]]
constexpr const_pointer_type data() const noexcept
{ return (get_category() == category::small) ? store.small : store.large.data; }

Expand Down Expand Up @@ -466,11 +466,11 @@ namespace jank
{ allocator_traits::deallocate(store, store.large.data, store.large.size + 1); }
}

[[gnu::always_inline, gnu::flatten, gnu::hot, gnu::const]]
[[gnu::const]]
constexpr category get_category() const noexcept
{ return static_cast<category>(store.bytes[last_char_index] & category_extraction_mask); }

[[gnu::always_inline, gnu::flatten, gnu::hot, gnu::const]]
[[gnu::const]]
constexpr size_type get_small_size() const noexcept
{
assert(get_category() == category::small);
Expand Down

0 comments on commit 66c2b2c

Please sign in to comment.