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