Skip to content

Commit

Permalink
libcore|Math: de::wrap asserts that the range is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Dec 26, 2015
1 parent b67126b commit 6f1586f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions doomsday/sdk/libcore/include/de/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ inline Type clamp(Type const &value, Type const &lowHighLimit) {
/// Wrap value within range [low, high).
template <typename Type>
Type wrap(Type value, Type const &low, Type const &high) {
DENG2_ASSERT(high > low);
Type const range = high - low;
while(value < low) value += range;
while(value >= high) value -= range;
Expand Down

0 comments on commit 6f1586f

Please sign in to comment.