Skip to content

Commit

Permalink
Fix unsigned number wrap-around
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzun committed Feb 11, 2024
1 parent 44dd2b8 commit 85e9d13
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ DigParams getDigParams(const ItemGroupList &groups,
// The actual number of uses increases
// exponentially with leveldiff.
// If the levels are equal, real_uses equals cap.uses.
u32 real_uses = cap.uses * pow(3.0, leveldiff);
real_uses = MYMIN(real_uses, U16_MAX);
const u32 real_uses = MYMIN(cap.uses * pow(3.0, leveldiff), U16_MAX);
result_wear = calculateResultWear(real_uses, initial_wear);
result_main_group = groupname;
}
Expand Down

0 comments on commit 85e9d13

Please sign in to comment.