equal
deleted
inserted
replaced
28 { |
28 { |
29 t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T)); |
29 t_ptr = (T*)realloc(t_ptr, num_elements * sizeof(T)); |
30 return t_ptr; |
30 return t_ptr; |
31 } |
31 } |
32 |
32 |
|
33 |
33 /** type safe swap operation */ |
34 /** type safe swap operation */ |
34 template <typename T> void SwapT(T *a, T *b); |
35 template<typename T> void Swap(T& a, T& b) |
35 |
|
36 template <typename T> FORCEINLINE void SwapT(T *a, T *b) |
|
37 { |
36 { |
38 T t = *a; |
37 T t = a; |
39 *a = *b; |
38 a = b; |
40 *b = t; |
39 b = t; |
41 } |
40 } |
42 |
41 |
43 |
42 |
44 /** returns the absolute value of (scalar) variable. @note assumes variable to be signed */ |
43 /** returns the absolute value of (scalar) variable. @note assumes variable to be signed */ |
45 template <typename T> static inline T myabs(T a) { return a < (T)0 ? -a : a; } |
44 template <typename T> static inline T myabs(T a) { return a < (T)0 ? -a : a; } |
139 if (++m_val >= end) m_val -= (storage_type)(end - begin); |
138 if (++m_val >= end) m_val -= (storage_type)(end - begin); |
140 return *this; |
139 return *this; |
141 } |
140 } |
142 }; |
141 }; |
143 |
142 |
144 template <typename Tenum_t> FORCEINLINE void SwapT(TinyEnumT<Tenum_t> *a, TinyEnumT<Tenum_t> *b) |
|
145 { |
|
146 SwapT(&a->m_val, &b->m_val); |
|
147 } |
|
148 |
|
149 template <typename T> FORCEINLINE T ClrBitT(T t, int bit_index) |
143 template <typename T> FORCEINLINE T ClrBitT(T t, int bit_index) |
150 { |
144 { |
151 int val = t; |
145 int val = t; |
152 CLRBIT(val, bit_index); |
146 CLRBIT(val, bit_index); |
153 return (T)val; |
147 return (T)val; |