Skip to content

Commit

Permalink
[libc] fix readability-identifier-naming in memory_utils/utils.h (#83919
Browse files Browse the repository at this point in the history
)

Fixes:

    libc/src/string/memory_utils/utils.h:345:13: warning: invalid case style
    for member 'offset_' [readability-identifier-naming]

Having a trailing underscore for members is a google3 style, not LLVM style.
Removing the underscore is insufficient, as we would then have 2 members with
the same identifier which is not allowed (it is a compile time error). Remove
the getter, and just access the renamed member that's now made public.
  • Loading branch information
nickdesaulniers committed Mar 5, 2024
1 parent 88d82b7 commit 640c857
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions libc/src/string/memory_utils/op_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ template <typename T> struct Memcmp {
if (LIBC_UNLIKELY(count >= threshold) && helper.not_aligned()) {
if (auto value = block(p1, p2))
return value;
adjust(helper.offset(), p1, p2, count);
adjust(helper.offset, p1, p2, count);
}
return loop_and_tail(p1, p2, count);
}
Expand Down Expand Up @@ -533,7 +533,7 @@ template <typename T> struct Bcmp {
if (LIBC_UNLIKELY(count >= threshold) && helper.not_aligned()) {
if (auto value = block(p1, p2))
return value;
adjust(helper.offset(), p1, p2, count);
adjust(helper.offset, p1, p2, count);
}
return loop_and_tail(p1, p2, count);
}
Expand Down
9 changes: 3 additions & 6 deletions libc/src/string/memory_utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,10 @@ LIBC_INLINE void align_to_next_boundary(T1 *__restrict &p1, T2 *__restrict &p2,

template <size_t SIZE> struct AlignHelper {
LIBC_INLINE AlignHelper(CPtr ptr)
: offset_(distance_to_next_aligned<SIZE>(ptr)) {}
: offset(distance_to_next_aligned<SIZE>(ptr)) {}

LIBC_INLINE bool not_aligned() const { return offset_ != SIZE; }
LIBC_INLINE uintptr_t offset() const { return offset_; }

private:
uintptr_t offset_;
LIBC_INLINE bool not_aligned() const { return offset != SIZE; }
uintptr_t offset;
};

LIBC_INLINE void prefetch_for_write(CPtr dst) {
Expand Down

0 comments on commit 640c857

Please sign in to comment.