xref: /freebsd/contrib/ntp/include/vint64ops.h (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
12b15cb3dSCy Schubert /*
22b15cb3dSCy Schubert  * vint64ops.h - operations on 'vint64' values
32b15cb3dSCy Schubert  *
42b15cb3dSCy Schubert  * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
52b15cb3dSCy Schubert  * The contents of 'html/copyright.html' apply.
62b15cb3dSCy Schubert  * ----------------------------------------------------------------------
72b15cb3dSCy Schubert  * This is an attempt to get the vint64 calculations stuff centralised.
82b15cb3dSCy Schubert  */
92b15cb3dSCy Schubert #ifndef VINT64OPS_H
102b15cb3dSCy Schubert #define VINT64OPS_H
112b15cb3dSCy Schubert 
122b15cb3dSCy Schubert /* signed/unsigned compare. returns 1/0/-1 if lhs >/=/< rhs */
132b15cb3dSCy Schubert extern int icmpv64(const vint64 * lhs,	const vint64 * rhs);
142b15cb3dSCy Schubert extern int ucmpv64(const vint64 * lhs,	const vint64 * rhs);
152b15cb3dSCy Schubert 
162b15cb3dSCy Schubert /* add / subtract */
172b15cb3dSCy Schubert extern vint64 addv64(const vint64 *lhs, const vint64 *rhs);
182b15cb3dSCy Schubert extern vint64 addv64i32(const vint64 * lhs, int32_t rhs);
192b15cb3dSCy Schubert extern vint64 addv64u32(const vint64 * lhs, uint32_t rhs);
202b15cb3dSCy Schubert 
212b15cb3dSCy Schubert extern vint64 subv64(const vint64 *lhs, const vint64 *rhs);
222b15cb3dSCy Schubert extern vint64 subv64i32(const vint64 * lhs, int32_t rhs);
232b15cb3dSCy Schubert extern vint64 subv64u32(const vint64 * lhs, uint32_t rhs);
242b15cb3dSCy Schubert 
252b15cb3dSCy Schubert /* parsing. works like strtoul() or strtoull() */
26*f5f40dd6SCy Schubert extern vint64 strtouv64(char * begp, char ** endp, int base);
272b15cb3dSCy Schubert 
282b15cb3dSCy Schubert #endif /*!defined(VINT64OPS_H)*/
29