add constcond

This commit is contained in:
christos 2017-01-10 17:44:51 +00:00
parent f8af623337
commit d472a9154a
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: difftime.c,v 1.16 2015/08/13 11:21:18 christos Exp $ */
/* $NetBSD: difftime.c,v 1.17 2017/01/10 17:44:51 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
@ -10,7 +10,7 @@
#if 0
static char elsieid[] = "@(#)difftime.c 8.1";
#else
__RCSID("$NetBSD: difftime.c,v 1.16 2015/08/13 11:21:18 christos Exp $");
__RCSID("$NetBSD: difftime.c,v 1.17 2017/01/10 17:44:51 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -32,6 +32,7 @@ difftime(time_t time1, time_t time0)
** If double is large enough, simply convert and subtract
** (assuming that the larger type has more precision).
*/
/*CONSTCOND*/
if (sizeof (time_t) < sizeof (double)) {
double t1 = time1, t0 = time0;
return t1 - t0;
@ -45,6 +46,7 @@ difftime(time_t time1, time_t time0)
return time0 <= time1 ? time1 - time0 : dminus(time0 - time1);
/* Use uintmax_t if wide enough. */
/*CONSTCOND*/
if (sizeof (time_t) <= sizeof (uintmax_t)) {
uintmax_t t1 = time1, t0 = time0;
return time0 <= time1 ? t1 - t0 : dminus(t0 - t1);