[Git][NTPsec/ntpsec][master] vint64ops.c goes away, replaced by scalar operations.
Eric S. Raymond
gitlab at mg.gitlab.com
Mon Dec 12 20:27:06 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
abb85c46 by Eric S. Raymond at 2016-12-12T15:26:12-05:00
vint64ops.c goes away, replaced by scalar operations.
- - - - -
5 changed files:
- − include/vint64ops.h
- − libntp/vint64ops.c
- libntp/wscript
- ntpd/ntp_leapsec.c
- tests/libntp/vi64ops.c
Changes:
=====================================
include/vint64ops.h deleted
=====================================
--- a/include/vint64ops.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * vint64ops.h - operations on 'vint64' values
- *
- * Written by Juergen Perlinger <perlinger at ntp.org> for the NTP project.
- * ----------------------------------------------------------------------
- * This is an attempt to get the vint64 calculations stuff centralised.
- *
- * Copyright 2015 by the NTPsec project contributors
- * SPDX-License-Identifier: NTP
- */
-#ifndef GUARD_VINT64OPS_H
-#define GUARD_VINT64OPS_H
-
-/* signed/unsigned compare. returns 1/0/-1 if lhs >/=/< rhs */
-extern int icmpv64(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);
-
-#endif /* GUARD_VINT64OPS_H */
=====================================
libntp/vint64ops.c deleted
=====================================
--- a/libntp/vint64ops.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * vint64ops.c - operations on 'vint64' values
- *
- * Written by Juergen Perlinger (perlinger at ntp.org) for the NTP project.
- * Copyright 2015 by the NTPsec project contributors
- * SPDX-License-Identifier: NTP
- * ----------------------------------------------------------------------
- * This is an attempt to get the vint64 calculations stuff centralised.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-
-#include "ntp_types.h"
-#include "ntp_fp.h"
-#include "vint64ops.h"
-
-/* -------------------------------------------------------------------------*/
-
-int
-icmpv64(
- const vint64 * lhs,
- const vint64 * rhs
- )
-{
- int res;
-
- res = (vint64s(*lhs) > vint64s(*rhs))
- - (vint64s(*lhs) < vint64s(*rhs));
-
- return res;
-}
-
-/* -------------------------------------------------------------------------*/
-
-vint64
-addv64(
- const vint64 *lhs,
- const vint64 *rhs
- )
-{
- vint64 res;
-
- setvint64u(res, vint64u(*lhs) + vint64u(*rhs));
-
- return res;
-}
-
-/* -------------------------------------------------------------------------*/
-
-vint64
-subv64(
- const vint64 *lhs,
- const vint64 *rhs
- )
-{
- vint64 res;
-
- setvint64u(res, vint64u(*lhs) - vint64u(*rhs));
-
- return res;
-}
-
-/* -------------------------------------------------------------------------*/
-
-vint64
-addv64i32(
- const vint64 * lhs,
- int32_t rhs
- )
-{
- vint64 res;
-
- res = *lhs;
- setvint64u(res, vint64u(res) + rhs);
-
- return res;
-}
-
-/* -------------------------------------------------------------------------*/
-
-vint64
-subv64i32(
- const vint64 * lhs,
- int32_t rhs
- )
-{
- vint64 res;
-
- res = *lhs;
- setvint64s(res, vint64s(res) - rhs);
-
- return res;
-}
-
-/* -------------------------------------------------------------------------*/
-
-vint64
-addv64u32(
- const vint64 * lhs,
- uint32_t rhs
- )
-{
- vint64 res;
-
- res = *lhs;
- setvint64u(res, vint64u(res) + rhs);
-
- return res;
-}
-
-/* -------------------------------------------------------------------------*/
-
-vint64
-subv64u32(
- const vint64 * lhs,
- uint32_t rhs
- )
-{
- vint64 res;
-
- res = *lhs;
- setvint64u(res, vint64u(res) - rhs);
-
- return res;
-}
=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -26,7 +26,6 @@ def build(ctx):
"socktoa.c",
"ssl_init.c",
"syssignal.c",
- "vint64ops.c",
"work_thread.c",
"ymd2yd.c",
]
=====================================
ntpd/ntp_leapsec.c
=====================================
--- a/ntpd/ntp_leapsec.c
+++ b/ntpd/ntp_leapsec.c
@@ -26,7 +26,6 @@
#include "ntp_calendar.h"
#include "ntp_leapsec.h"
#include "ntp.h"
-#include "vint64ops.h"
#include "lib_strbuf.h"
#include "isc/sha1.h"
@@ -247,7 +246,7 @@ leapsec_dump(
while (idx-- != 0) {
ts = pt->info[idx].ttime;
ntpcal_ntp64_to_date(&ttb, &ts);
- ts = subv64u32(&ts, pt->info[idx].stime);
+ ts = ts - pt->info[idx].stime;
ntpcal_ntp64_to_date(&atb, &ts);
(*func)(farg, "%04u-%02u-%02u [%c] (%04u-%02u-%02u) - %d\n",
@@ -297,7 +296,7 @@ leapsec_query(
last = pt->head.ttime;
qr->warped = (int16_t)(vint64lo(last) -
vint64lo(pt->head.dtime));
- next = addv64i32(&ts64, qr->warped);
+ next = ts64 + qr->warped;
reload_limits(pt, next);
fired = (pt->head.ebase == last);
if (fired) {
@@ -543,7 +542,7 @@ leapsec_daystolive(
pt = leapsec_get_table(false);
limit = ntpcal_ntp_to_ntp(when, tpiv);
- limit = subv64(&pt->head.expire, &limit);
+ limit = pt->head.expire - limit;
return ntpcal_daysplit(&limit).hi;
}
@@ -752,12 +751,10 @@ reload_limits(
if (_electric)
pt->head.dtime = pt->head.ttime;
else
- pt->head.dtime = addv64i32(
- &pt->head.ttime,
- pt->head.next_tai - pt->head.this_tai);
+ pt->head.dtime = pt->head.ttime +
+ pt->head.next_tai - pt->head.this_tai;
- pt->head.stime = subv64u32(
- &pt->head.ttime, pt->info[idx].stime);
+ pt->head.stime = pt->head.ttime - pt->info[idx].stime;
} else {
memset(&pt->head.ttime, 0xFF, sizeof(vint64));
=====================================
tests/libntp/vi64ops.c
=====================================
--- a/tests/libntp/vi64ops.c
+++ b/tests/libntp/vi64ops.c
@@ -10,9 +10,6 @@ TEST_SETUP(vi64ops) {}
TEST_TEAR_DOWN(vi64ops) {}
-
-#include "vint64ops.h"
-
TEST(vi64ops, HiLoVUI64uh) {
vint64 exp = 0;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/abb85c46c311ad2ea34dcdb9768719cb85926ba6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161212/1b5fc3fb/attachment.html>
More information about the vc
mailing list