summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorMarc Alexander Lehmann <libev@schmorp.de>2019-07-07 06:00:31 +0000
committerMarc Alexander Lehmann <libev@schmorp.de>2019-07-07 06:00:31 +0000
commit89d55438b847ed025035fde1c1ff8d7e5f16505f (patch)
treeb6688c8acca088e24c951a2e435a6a1f2dfff599 /ev.c
parentb499e38a35e04f73fa36eb817a489004f395f6b4 (diff)
downloadlibev-89d55438b847ed025035fde1c1ff8d7e5f16505f.tar.gz
libev-89d55438b847ed025035fde1c1ff8d7e5f16505f.zip
*** empty log message ***
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ev.c b/ev.c
index e3d43c4..432aa68 100644
--- a/ev.c
+++ b/ev.c
@@ -1728,26 +1728,26 @@ ev_floor (ev_tstamp v)
const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 18446744073709551616. : 4294967296.;
#endif
- /* argument too large for an unsigned long? */
+ /* special treatment for negative arguments */
+ if (ecb_expect_false (v < 0.))
+ {
+ ev_tstamp f = -ev_floor (-v);
+
+ return f - (f == v ? 0 : 1);
+ }
+
+ /* argument too large for an unsigned long? then reduce it */
if (ecb_expect_false (v >= shift))
{
ev_tstamp f;
if (v == v - 1.)
- return v; /* very large number */
+ return v; /* very large numbers are assumed to be integer */
f = shift * ev_floor (v * (1. / shift));
return f + ev_floor (v - f);
}
- /* special treatment for negative args? */
- if (ecb_expect_false (v < 0.))
- {
- ev_tstamp f = -ev_floor (-v);
-
- return f - (f == v ? 0 : 1);
- }
-
/* fits into an unsigned long */
return (unsigned long)v;
}