mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-10 06:01:52 +00:00
libvapours: introduce BITL, MASK, MASKL, MASK2, MASK2L which were already present in other ams components
This commit is contained in:
parent
6ecf04c3b7
commit
877b2cf790
1 changed files with 25 additions and 0 deletions
|
@ -52,6 +52,31 @@ typedef u32 Result; ///< Function error code result type.
|
|||
#define BIT(n) (1U<<(n))
|
||||
#endif
|
||||
|
||||
/// Creates a bitmask from a bit number (long).
|
||||
#ifndef BITL
|
||||
#define BITL(n) (1UL<<(n))
|
||||
#endif
|
||||
|
||||
/// Creates a bitmask representing the n least significant bits.
|
||||
#ifndef MASK
|
||||
#define MASK(n) (BIT(n) - 1U)
|
||||
#endif
|
||||
|
||||
/// Creates a bitmask representing the n least significant bits (long).
|
||||
#ifndef MASKL
|
||||
#define MASKL(n) (BITL(n) - 1UL)
|
||||
#endif
|
||||
|
||||
/// Creates a bitmask for bit range extraction.
|
||||
#ifndef MASK2
|
||||
#define MASK2(a,b) (MASK(a) & ~MASK(b))
|
||||
#endif
|
||||
|
||||
/// Creates a bitmask for bit range extraction (long).
|
||||
#ifndef MASK2L
|
||||
#define MASK2L(a,b) (MASKL(a) & ~MASKL(b))
|
||||
#endif
|
||||
|
||||
/// Marks a function as not returning, for the purposes of compiler optimization.
|
||||
#ifndef NORETURN
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
|
|
Loading…
Reference in a new issue