aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jtutil/util.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/jtutil/util.hh b/src/jtutil/util.hh
index ba1b077..c07cb5e 100644
--- a/src/jtutil/util.hh
+++ b/src/jtutil/util.hh
@@ -17,6 +17,10 @@ namespace jtutil
inline int how_many_in_range(int low, int high)
{ return high - low + 1; }
+// is an integer even/odd
+inline int is_even(int i) { return !(i & 0x1); }
+inline int is_odd (int i) { return (i & 0x1); }
+
//
// minimum/maximum templates (valid for both integer and floating-point types)
// FIXME: these are supposed to be in the STL,