mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 17:14:28 -04:00
loader: avoid UB when doing count trailing zeros
This commit is contained in:
parent
15381409dc
commit
dbcb1e1564
2 changed files with 49 additions and 10 deletions
|
@ -44,7 +44,7 @@ namespace ams::ldr::caps {
|
|||
constexpr ALWAYS_INLINE typename name::Type Get##name() const { return this->Get<name>(); }
|
||||
|
||||
constexpr ALWAYS_INLINE CapabilityId GetCapabilityId(util::BitPack32 cap) {
|
||||
return static_cast<CapabilityId>(__builtin_ctz(~cap.value));
|
||||
return static_cast<CapabilityId>(util::CountTrailingZeros<u32>(~cap.value));
|
||||
}
|
||||
|
||||
constexpr inline util::BitPack32 EmptyCapability = {~u32{}};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue