From b9f739324a59e88e636174f70f25669f7ae49ed2 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 28 Mar 2019 14:27:02 +1100 Subject: [PATCH] maths: add pow2 convenience function --- maths.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/maths.hpp b/maths.hpp index 83ef32d1..452f35c0 100644 --- a/maths.hpp +++ b/maths.hpp @@ -192,6 +192,13 @@ namespace cruft { } + //------------------------------------------------------------------------- + template + constexpr auto + pow2 [[gnu::const]] (ValueT const &val) + { return val * val; } + + //------------------------------------------------------------------------- template constexpr