Skip to content

Commit

Permalink
fixed warning in folly::align_ceil
Browse files Browse the repository at this point in the history
Summary:
Fix the following warning on windows with msvc:

```
folly/lang/Align.h(222,35): warning C4146: unary minus operator applied to unsigned type, result still unsigned
```

Reviewed By: Orvid

Differential Revision: D61764439

fbshipit-source-id: f5eb9a51c6c81c4965cb4f7c11f0971aa99df950
  • Loading branch information
Cedric Perthuis authored and facebook-github-bot committed Aug 27, 2024
1 parent fb142f5 commit 650b42a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion folly/lang/Align.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ struct align_ceil_fn {
constexpr std::uintptr_t operator()(
std::uintptr_t x, std::size_t alignment) const {
detail::validateAlignment(alignment);
return (x + alignment - 1) & (-alignment);
auto alignmentAsInt = static_cast<std::intptr_t>(alignment);
return (x + alignmentAsInt - 1) & (-alignmentAsInt);
}

template <typename T>
Expand Down

0 comments on commit 650b42a

Please sign in to comment.