(svn r8864) -Codechange: make ClrBitT(), SetBitT() and ToggleBitT more like CLRBIT() and so on (modify value of the first parameter instead or returning the result)

This commit is contained in:
KUDr
2007-02-23 20:51:10 +00:00
parent c924185f97
commit 8001ab69fb
4 changed files with 12 additions and 18 deletions

View File

@@ -138,25 +138,19 @@ template <typename Tenum_t> struct TinyEnumT
}
};
template <typename T> FORCEINLINE T ClrBitT(T t, int bit_index)
template <typename T> void ClrBitT(T &t, int bit_index)
{
int val = t;
CLRBIT(val, bit_index);
return (T)val;
t = (T)(t & ~((T)1 << bit_index));
}
template <typename T> FORCEINLINE T SetBitT(T t, int bit_index)
template <typename T> void SetBitT(T &t, int bit_index)
{
int val = t;
SETBIT(val, bit_index);
return (T)val;
t = (T)(t | ((T)1 << bit_index));
}
template <typename T> FORCEINLINE T ToggleBitT(T t, int bit_index)
template <typename T> void ToggleBitT(T &t, int bit_index)
{
int val = t;
TOGGLEBIT(val, bit_index);
return (T)val;
t = (T)(t ^ ((T)1 << bit_index));
}
#endif /* HELPERS_HPP */