Added sign.hh to go with libmormegil::sign.3
authorMartin Read <mpread@chiark.greenend.org.uk>
Wed, 6 Apr 2011 18:32:41 +0000 (19:32 +0100)
committerMartin Read <mpread@chiark.greenend.org.uk>
Wed, 6 Apr 2011 18:32:41 +0000 (19:32 +0100)
include/libmormegil/sign.hh [new file with mode: 0644]

diff --git a/include/libmormegil/sign.hh b/include/libmormegil/sign.hh
new file mode 100644 (file)
index 0000000..754dbe1
--- /dev/null
@@ -0,0 +1,19 @@
+// libmormegil/sign.hh
+//
+// In jurisdictions where this file would be adjuged to contain copyrightable
+// material, it is copyright 2011 Martin Read, and released to the public
+// under the terms of the Creative Commons Public Domain Dedication (cc-0).
+// It is provided without any warranty, express or implied.
+
+#ifndef libmormegil_sign_hh
+#define libmormegil_sign_hh
+
+namespace libmormegil
+    template<typename T> inline bool sign(const T& i)
+    {
+        return (i < T(0)) ? -1 : (i > T(0)) ? 1 : 0;
+    }
+}
+#endif // libmormegil_sign_hh
+
+// vim:ts=8:sw=4:expandtab:fo=c