1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-10 14:11:43 +00:00

libvapours: introduce BITL, MASK, MASKL, MASK2, MASK2L which were already present in other ams components

This commit is contained in:
TuxSH 2020-02-03 23:01:00 +00:00
parent 6ecf04c3b7
commit 877b2cf790

View file

@ -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))