Skip to content
Snippets Groups Projects
Commit a16b4f78 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Simplify floor division function.

parent 5701cf5a
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include "mtime_calendarGregorian.h"
#include "mtime_julianDay.h"
......@@ -20,22 +21,13 @@
static const int msn[12] =
{ 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337 };
/* Internal function. */
/* Compute floor division */
static
int64_t
ifloor(int64_t ir1, int64_t ir2)
{
int64_t r;
int64_t ifl;
r = (ir1 % ir2);
ifl = ir1 / ir2;
if (r < 0)
{
ifl = ifl - 1;
}
return ifl;
lldiv_t r = lldiv(ir1, ir2);
return r.quot - (r.rem < 0);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment