Skip to content

Commit

Permalink
Fix modify!; return a Pair (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf authored May 7, 2022
1 parent 11d5f57 commit ce0e5f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "UnsafeAtomics"
uuid = "013be700-e6cd-48c3-b4a1-df204f14c38f"
authors = ["Takafumi Arakaki <[email protected]> and contributors"]
version = "0.1.1-DEV"
version = "0.2.0-DEV"

[compat]
julia = "1"
Expand Down
2 changes: 1 addition & 1 deletion src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ for typ in inttypes
x,
v,
)
return (old, $op(old, v))
return old => $op(old, v)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/UnsafeAtomicsTests/src/test_core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function test_default_ordering(T::Type)
@test xs[1] === x2
@testset for (op, name) in OP_RMW_TABLE
xs[1] = x1
@test UnsafeAtomics.modify!(ptr, op, x2) === (x1, op(x1, x2))
@test UnsafeAtomics.modify!(ptr, op, x2) === (x1 => op(x1, x2))
@test xs[1] === op(x1, x2)

rmw = getfield(UnsafeAtomics, Symbol(name, :!))
Expand Down Expand Up @@ -54,7 +54,7 @@ function test_explicit_ordering(T::Type = UInt)
@test xs[1] === x2
@testset for (op, name) in OP_RMW_TABLE
xs[1] = x1
@test UnsafeAtomics.modify!(ptr, op, x2, acq_rel) === (x1, op(x1, x2))
@test UnsafeAtomics.modify!(ptr, op, x2, acq_rel) === (x1 => op(x1, x2))
@test xs[1] === op(x1, x2)

rmw = getfield(UnsafeAtomics, Symbol(name, :!))
Expand Down

0 comments on commit ce0e5f2

Please sign in to comment.