Skip to content

Commit

Permalink
fix some windows errors and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyaskal committed Jul 18, 2024
1 parent ef98c4c commit 669f399
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .evergreen/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ run_ctest() {

run_python() {
pys=(
/Users/shreyaskal/dev/bin/python
py
python3.14
python3.13
Expand Down
9 changes: 7 additions & 2 deletions src/mc-range-encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,17 @@ bool mc_getTypeInfo64(mc_getTypeInfo64_args_t args, mc_OSTType_Int64 *out, mongo
#define UINT_64_MAX 18446744073709551615ull

uint64_t subtract_int64_t(int64_t max, int64_t min) {
// If the values have the same sign, then simple subtraction
// will work because we know max > min.
if ((max > 0 && min > 0) || (max < 0 && min < 0)) {
return (uint64_t)(max - min);
}

uint64_t u_return = (uint64_t)labs(max);
u_return += (uint64_t)labs(min);
// If they are opposite signs, then we can just do a small
// abs_val addition trick to perform subtraction, since it
// is just the sum of differences between the values and 0.
uint64_t u_return = (uint64_t)llabs(max);
u_return += (uint64_t)llabs(min);
return u_return;
}

Expand Down

0 comments on commit 669f399

Please sign in to comment.