From 395e6ec8dba0d082f4b5002ce67fead1948fbe51 Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Thu, 11 Aug 2016 22:25:05 +0200 Subject: [PATCH] Add std::ceil_divide --- tstl/include/math.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tstl/include/math.hpp diff --git a/tstl/include/math.hpp b/tstl/include/math.hpp new file mode 100644 index 00000000..1ff1612f --- /dev/null +++ b/tstl/include/math.hpp @@ -0,0 +1,20 @@ +//======================================================================= +// Copyright Baptiste Wicht 2013-2016. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#ifndef MATH_HPP +#define MATH_HPP + +namespace std { + +template +T ceil_divide(T base, T divisor){ + return (base + divisor - 1) / divisor; +} + +} //end of namespace std + +#endif