Skip to content

Commit

Permalink
libdeng2: Added ceilPow2
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Dec 5, 2013
1 parent a72cef7 commit 8065cbf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doomsday/libdeng2/include/de/math.h
Expand Up @@ -152,6 +152,13 @@ inline dint cmp(Type const &a, Type const &b) {
return 0;
}

template <typename IntType>
IntType ceilPow2(IntType const &num) {
IntType cumul;
for(cumul = 1; num > cumul; cumul <<= 1) {}
return cumul;
}

} // namespace de

#endif /* LIBDENG2_MATH_H */

0 comments on commit 8065cbf

Please sign in to comment.