diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-26 08:34:59 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-26 08:34:59 +0000 |
commit | f11e3b1d535565ab72681ab3eafcc133df127e1f (patch) | |
tree | bb3ef1d19eaf742647cf60c58817871949d5364d /src/jtutil | |
parent | 332af1746a0a0e5c9371729e6072ea08153e2f61 (diff) |
add is_even() and is_odd() integer predicates
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@113 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/jtutil')
-rw-r--r-- | src/jtutil/util.hh | 4 |
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, |