aboutsummaryrefslogtreecommitdiff
path: root/include/vint64ops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/vint64ops.h')
-rw-r--r--include/vint64ops.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/vint64ops.h b/include/vint64ops.h
new file mode 100644
index 000000000000..2c3deffb3813
--- /dev/null
+++ b/include/vint64ops.h
@@ -0,0 +1,28 @@
+/*
+ * vint64ops.h - operations on 'vint64' values
+ *
+ * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
+ * The contents of 'html/copyright.html' apply.
+ * ----------------------------------------------------------------------
+ * This is an attempt to get the vint64 calculations stuff centralised.
+ */
+#ifndef VINT64OPS_H
+#define VINT64OPS_H
+
+/* signed/unsigned compare. returns 1/0/-1 if lhs >/=/< rhs */
+extern int icmpv64(const vint64 * lhs, const vint64 * rhs);
+extern int ucmpv64(const vint64 * lhs, const vint64 * rhs);
+
+/* add / subtract */
+extern vint64 addv64(const vint64 *lhs, const vint64 *rhs);
+extern vint64 addv64i32(const vint64 * lhs, int32_t rhs);
+extern vint64 addv64u32(const vint64 * lhs, uint32_t rhs);
+
+extern vint64 subv64(const vint64 *lhs, const vint64 *rhs);
+extern vint64 subv64i32(const vint64 * lhs, int32_t rhs);
+extern vint64 subv64u32(const vint64 * lhs, uint32_t rhs);
+
+/* parsing. works like strtoul() or strtoull() */
+extern vint64 strtouv64(const char * begp, char ** endp, int base);
+
+#endif /*!defined(VINT64OPS_H)*/