NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
lyt_types.hpp
1// https://raw.githubusercontent.com/doldecomp/ogws/d5505bee60a51db06eab3800421bdb1237c45e92/include/nw4r/lyt/lyt_types.h
2
3#pragma once
4
5namespace nw4r {
6namespace lyt {
7namespace detail {
8
9/******************************************************************************
10 *
11 * Bit operations
12 *
13 ******************************************************************************/
14template <typename T> inline void SetBit(T* pBits, int pos, bool value) {
15 T mask = ~(1 << pos);
16 *pBits &= mask;
17 *pBits |= (value ? 1 : 0) << pos;
18}
19template <typename T> inline bool TestBit(T bits, int pos) {
20 T mask = 1 << pos;
21 return (bits & mask) != 0;
22}
23template <typename T> inline T GetBits(T bits, int pos, int len) {
24 T mask = ~(static_cast<T>(-1) << len);
25 return bits >> pos & mask;
26}
27
28} // namespace detail
29} // namespace lyt
30} // namespace nw4r
2D graphics drawing library.