mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 03:12:20 +00:00
flip max for min
This commit is contained in:
parent
3606543ac0
commit
a4f0ed1990
1 changed files with 3 additions and 3 deletions
|
@ -135,13 +135,13 @@ pub fn increfC(ptr_to_refcount: *isize, amount: isize) callconv(.C) void {
|
|||
if (refcount < REFCOUNT_MAX_ISIZE) {
|
||||
switch (RC_TYPE) {
|
||||
Refcount.normal => {
|
||||
ptr_to_refcount.* = std.math.max(refcount + amount, REFCOUNT_MAX_ISIZE);
|
||||
ptr_to_refcount.* = std.math.min(refcount + amount, REFCOUNT_MAX_ISIZE);
|
||||
},
|
||||
Refcount.atomic => {
|
||||
var next = std.math.max(refcount + amount, REFCOUNT_MAX_ISIZE);
|
||||
var next = std.math.min(refcount + amount, REFCOUNT_MAX_ISIZE);
|
||||
while (@cmpxchgWeak(isize, ptr_to_refcount, refcount, next, Monotonic, Monotonic)) |found| {
|
||||
refcount = found;
|
||||
next = std.math.max(refcount + amount, REFCOUNT_MAX_ISIZE);
|
||||
next = std.math.min(refcount + amount, REFCOUNT_MAX_ISIZE);
|
||||
}
|
||||
},
|
||||
else => unreachable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue