From 94d098f8ef8672856ce94ec3e78d11b1d0b8efc0 Mon Sep 17 00:00:00 2001 From: "Richard C. Gobeille" Date: Mon, 20 Apr 2020 12:51:36 -0700 Subject: [PATCH] Fix a crash with tabledivide64() Fixes #1. --- source/build/include/pragmas.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index 0efe3ee27..ebe3d4838 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -52,8 +52,8 @@ skip: static inline int64_t tabledivide64(int64_t const n, int64_t const d) { static libdivide::libdivide_s64_t sdiv; - static int32_t lastd; - auto const dptr = ((unsigned)d < DIVTABLESIZE) ? &divtable64[d] : &sdiv; + static int64_t lastd; + auto const dptr = ((uint64_t)d < DIVTABLESIZE) ? &divtable64[d] : &sdiv; if (d == lastd || dptr != &sdiv) goto skip; @@ -67,7 +67,7 @@ static inline int32_t tabledivide32(int32_t const n, int32_t const d) { static libdivide::libdivide_s32_t sdiv; static int32_t lastd; - auto const dptr = ((unsigned)d < DIVTABLESIZE) ? &divtable32[d] : &sdiv; + auto const dptr = ((uint32_t)d < DIVTABLESIZE) ? &divtable32[d] : &sdiv; if (d == lastd || dptr != &sdiv) goto skip;