[libcxx-commits] [libcxx] [libc++] Implement LWG4290: Missing Mandates clauses on is_sufficiently_aligned (PR #229765)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 8 04:05:21 PDT 2026
https://github.com/philnik777 commented:
> Since this is my first patch, the PR is limited to the static assert check. However, we could now theoretically replace the modulo operator `%` with a bitwise and operator `&` for the alignment check:
>
> ```
> return (reinterpret_cast<uintptr_t>(__ptr) & (_Alignment - 1)) == 0;
> ```
>
> Just thought I would raise this for discussion. I am not sure if that makes a difference past `-O0`; whether there's any interest in that; if that would belong in a separate PR.
The compiler does that even at -O0 AFAICT: https://godbolt.org/z/hroonYYfj
https://github.com/llvm/llvm-project/pull/229765
More information about the libcxx-commits
mailing list