sde: Move utility functions to common header file
Move utility functions to common header file accesible from SDE and HWC modules. Change-Id: Id5183bb8f41a223273c973960f653f155e3c4c05
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
f1f85ba397
commit
2ba9789b07
@@ -53,6 +53,24 @@
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
template <class T>
|
||||
inline void Swap(T &a, T &b) {
|
||||
T c(a);
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
// factor value should be in powers of 2(eg: 1, 2, 4, 8)
|
||||
template <class T1, class T2>
|
||||
inline T1 FloorToMultipleOf(const T1 &value, const T2 &factor) {
|
||||
return (T1)(value & (~(factor - 1)));
|
||||
}
|
||||
|
||||
template <class T1, class T2>
|
||||
inline T1 CeilToMultipleOf(const T1 &value, const T2 &factor) {
|
||||
return (T1)((value + (factor - 1)) & (~(factor - 1)));
|
||||
}
|
||||
|
||||
namespace sde {
|
||||
|
||||
const int kThreadPriorityUrgent = -9;
|
||||
|
||||
Reference in New Issue
Block a user