diff --git a/include/mcl/vint.hpp b/include/mcl/vint.hpp index 40f43b2..13e24e7 100644 --- a/include/mcl/vint.hpp +++ b/include/mcl/vint.hpp @@ -150,7 +150,7 @@ inline uint32_t divUnit(uint32_t *pr, uint32_t H, uint32_t L, uint32_t y) #if MCL_SIZEOF_UNIT == 8 inline uint64_t divUnit(uint64_t *pr, uint64_t H, uint64_t L, uint64_t y) { -#if defined(MCL_VINT_64BIT_PORTABLE) +#if defined(MCL_VINT_64BIT_PORTABLE) || (defined(_MSC_VER) && _MSC_VER < 1920) uint32_t px[4] = { uint32_t(L), uint32_t(L >> 32), uint32_t(H), uint32_t(H >> 32) }; uint32_t py[2] = { uint32_t(y), uint32_t(y >> 32) }; size_t xn = 4; @@ -162,7 +162,7 @@ inline uint64_t divUnit(uint64_t *pr, uint64_t H, uint64_t L, uint64_t y) *pr = make64(r[1], r[0]); return make64(q[1], q[0]); #elif defined(_MSC_VER) - #error "divUnit for uint64_t is not supported" + return _udiv128(H, L, y, pr); #else typedef __attribute__((mode(TI))) unsigned int uint128; uint128 t = (uint128(H) << 64) | L; diff --git a/test/vint_test.cpp b/test/vint_test.cpp index ab37814..39c3688 100644 --- a/test/vint_test.cpp +++ b/test/vint_test.cpp @@ -9,6 +9,7 @@ #include #ifndef MCL_USE_VINT #include +#include #endif #define PUT(x) std::cout << #x "=" << x << std::endl;