mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- use constexpr for translation utilities
This commit is contained in:
parent
c3ddde02b2
commit
a690f44fc8
1 changed files with 9 additions and 6 deletions
|
@ -59,19 +59,22 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define TRANSLATION_SHIFT 16
|
enum
|
||||||
#define TRANSLATION_MASK ((1<<TRANSLATION_SHIFT)-1)
|
{
|
||||||
#define TRANSLATIONTYPE_MASK (255<<TRANSLATION_SHIFT)
|
TRANSLATION_SHIFT = 16,
|
||||||
|
TRANSLATION_MASK = ((1 << TRANSLATION_SHIFT) - 1),
|
||||||
|
TRANSLATIONTYPE_MASK = (255 << TRANSLATION_SHIFT)
|
||||||
|
};
|
||||||
|
|
||||||
inline uint32_t TRANSLATION(uint8_t a, uint32_t b)
|
inline constexpr uint32_t TRANSLATION(uint8_t a, uint32_t b)
|
||||||
{
|
{
|
||||||
return (a << TRANSLATION_SHIFT) | b;
|
return (a << TRANSLATION_SHIFT) | b;
|
||||||
}
|
}
|
||||||
inline int GetTranslationType(uint32_t trans)
|
inline constexpr int GetTranslationType(uint32_t trans)
|
||||||
{
|
{
|
||||||
return (trans & TRANSLATIONTYPE_MASK) >> TRANSLATION_SHIFT;
|
return (trans & TRANSLATIONTYPE_MASK) >> TRANSLATION_SHIFT;
|
||||||
}
|
}
|
||||||
inline int GetTranslationIndex(uint32_t trans)
|
inline constexpr int GetTranslationIndex(uint32_t trans)
|
||||||
{
|
{
|
||||||
return (trans & TRANSLATION_MASK);
|
return (trans & TRANSLATION_MASK);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue