Skip to content

[libc] fix -Wshorten-64-to-32 #74392

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

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions libc/src/string/memory_utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ LIBC_INLINE constexpr size_t log2s(size_t value) {
// Returns the first power of two preceding value or value if it is already a
// power of two (or 0 when value is 0).
LIBC_INLINE constexpr size_t le_power2(size_t value) {
return value == 0 ? value : 1ULL << log2s(value);
return value == 0 ? value : 1UL << log2s(value);
}

// Returns the first power of two following value or value if it is already a
// power of two (or 0 when value is 0).
LIBC_INLINE constexpr size_t ge_power2(size_t value) {
return is_power2_or_zero(value) ? value : 1ULL << (log2s(value) + 1);
return is_power2_or_zero(value) ? value : 1UL << (log2s(value) + 1);
}

// Returns the number of bytes to substract from ptr to get to the previous
Expand Down