Commit 8b34b1dd authored by Richard Gobeille's avatar Richard Gobeille

engine: add divideu64()/divideu64_noinline()

parent 2db56a30
......@@ -58,6 +58,19 @@ skip:
return libdivide::libdivide_u32_do(n, &udiv);
static inline uint64_t divideu64(uint64_t const n, uint64_t const d)
static libdivide::libdivide_u64_t udiv;
static uint64_t lastd;
if (d == lastd)
goto skip;
udiv = libdivide::libdivide_u64_gen((lastd = d));
return libdivide::libdivide_u64_do(n, &udiv);
static inline int64_t tabledivide64(int64_t const n, int64_t const d)
static libdivide::libdivide_s64_t sdiv;
......@@ -87,6 +100,7 @@ skip:
extern uint32_t divideu32_noinline(uint32_t n, uint32_t d);
extern uint64_t divideu64_noinline(uint64_t n, uint64_t d);
extern int32_t tabledivide32_noinline(int32_t n, int32_t d);
extern int64_t tabledivide64_noinline(int64_t n, int64_t d);
......@@ -23,6 +23,7 @@ void initdivtables(void)
uint32_t divideu32_noinline(uint32_t n, uint32_t d) { return divideu32(n, d); }
uint64_t divideu64_noinline(uint64_t n, uint64_t d) { return divideu64(n, d); }
int32_t tabledivide32_noinline(int32_t n, int32_t d) { return tabledivide32(n, d); }
int64_t tabledivide64_noinline(int64_t n, int64_t d) { return tabledivide64(n, d); }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment