xref: /freebsd/contrib/ntp/include/vint64ops.h (revision 69d94f4c7608e41505996559367450706e91fbb8)
1 /*
2  * vint64ops.h - operations on 'vint64' values
3  *
4  * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
5  * The contents of 'html/copyright.html' apply.
6  * ----------------------------------------------------------------------
7  * This is an attempt to get the vint64 calculations stuff centralised.
8  */
9 #ifndef VINT64OPS_H
10 #define VINT64OPS_H
11 
12 /* signed/unsigned compare. returns 1/0/-1 if lhs >/=/< rhs */
13 extern int icmpv64(const vint64 * lhs,	const vint64 * rhs);
14 extern int ucmpv64(const vint64 * lhs,	const vint64 * rhs);
15 
16 /* add / subtract */
17 extern vint64 addv64(const vint64 *lhs, const vint64 *rhs);
18 extern vint64 addv64i32(const vint64 * lhs, int32_t rhs);
19 extern vint64 addv64u32(const vint64 * lhs, uint32_t rhs);
20 
21 extern vint64 subv64(const vint64 *lhs, const vint64 *rhs);
22 extern vint64 subv64i32(const vint64 * lhs, int32_t rhs);
23 extern vint64 subv64u32(const vint64 * lhs, uint32_t rhs);
24 
25 /* parsing. works like strtoul() or strtoull() */
26 extern vint64 strtouv64(const char * begp, char ** endp, int base);
27 
28 #endif /*!defined(VINT64OPS_H)*/
29