Skip to content

Commit

Permalink
saving
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Jan 31, 2024
1 parent cef71e5 commit 8b4732e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/fastmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ FASTMOD_API int32_t fastmod_s32(int32_t a, uint64_t M, int32_t positive_d) {
return highbits - ((positive_d - 1) & (a >> 31));
}

#ifndef _MSC_VER

// fastdiv computes (a / d) given a precomputed M, assumes that d must not
// be one of -1, 1, or -2147483648
// Unsupported under VS, todo: fix.
FASTMOD_API int32_t fastdiv_s32(int32_t a, uint64_t M, int32_t d) {
uint64_t highbits = mul128_s32(M, a);
highbits += (a < 0 ? 1 : 0);
Expand All @@ -133,7 +136,6 @@ FASTMOD_API int32_t fastdiv_s32(int32_t a, uint64_t M, int32_t d) {
return (int32_t)(highbits);
}

#ifndef _MSC_VER
// What follows is the 64-bit functions.
// They are currently not supported on Visual Studio
// due to the lack of a mul128_u64 function.
Expand Down

0 comments on commit 8b4732e

Please sign in to comment.