We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
set
Accumulator
1 parent e308669 commit bb366bfCopy full SHA for bb366bf
src/kcas_data/accumulator.ml
@@ -36,7 +36,10 @@ module Xt = struct
36
let s = Xt.get ~xt (Array.unsafe_get a i) in
37
if i = 0 then s else get ~xt a s (i - 1)
38
39
- let set ~xt a n = add ~xt a (n - get ~xt a)
+ let set ~xt a n =
40
+ let delta = n - get ~xt a in
41
+ if delta <> 0 then
42
+ Xt.fetch_and_add ~xt (Array.unsafe_get a 0) delta |> ignore
43
end
44
45
let add a n = if n <> 0 then Loc.fetch_and_add (get_self a) n |> ignore
0 commit comments