diff options
Diffstat (limited to 'include/media/stagefright/foundation/AUtils.h')
-rw-r--r-- | include/media/stagefright/foundation/AUtils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/media/stagefright/foundation/AUtils.h b/include/media/stagefright/foundation/AUtils.h index 3a73a39..d7ecf50 100644 --- a/include/media/stagefright/foundation/AUtils.h +++ b/include/media/stagefright/foundation/AUtils.h @@ -40,6 +40,12 @@ inline static const T divUp(const T &nom, const T &den) { } } +/* == ceil(nom / den) * den. T must be integer type, alignment must be positive power of 2 */ +template<class T, class U> +inline static const T align(const T &nom, const U &den) { + return (nom + (T)(den - 1)) & (T)~(den - 1); +} + template<class T> inline static T abs(const T &a) { return a < 0 ? -a : a; |