From dac3cd622f82c127fce8e57004e540c0eb6024a5 Mon Sep 17 00:00:00 2001 From: KUDr Date: Fri, 23 Feb 2007 20:51:10 +0000 Subject: (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) --- src/helpers.hpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/helpers.hpp') diff --git a/src/helpers.hpp b/src/helpers.hpp index 5f378803a..fb5aeb5f8 100644 --- a/src/helpers.hpp +++ b/src/helpers.hpp @@ -138,25 +138,19 @@ template struct TinyEnumT } }; -template FORCEINLINE T ClrBitT(T t, int bit_index) +template 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 FORCEINLINE T SetBitT(T t, int bit_index) +template 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 FORCEINLINE T ToggleBitT(T t, int bit_index) +template 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 */ -- cgit v1.2.3-54-g00ecf