Skip to content

Commit

Permalink
improve behaviour when accessing concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
slawo-ch committed Sep 21, 2018
1 parent 943e537 commit fc315b6
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ public T get(ConstShapeMap<? extends T> shapeMap){
return (T) storage[idx1];
}
else if (shape1 == null){
shape1 = s;
idx1 = s.idxFor(k);
shape1 = s;
return (T) storage[idx1];
}
else{
Expand All @@ -536,8 +536,8 @@ public T put(ConstShapeMap<? super T> shapeMap, T v){
}

if (shape1 == null){
shape1 = shapeMap.shape;
idx1 = shape1.idxFor(k);
idx1 = s.idxFor(k);
shape1 = s;
T o = (T) shapeMap.storage[idx1];
shapeMap.storage[idx1] = v;
return o;
Expand Down Expand Up @@ -568,13 +568,13 @@ public void set(ConstShapeMap<? super T> shapeMap, T v){
}

if (shape1 == null){
shape1 = shapeMap.shape;
idx1 = shape1.idxFor(k);
idx1 = s.idxFor(k);
shape1 = s;
shapeMap.storage[idx1] = v;
return;
}

int idx = shapeMap.shape.idxFor(k);
int idx = s.idxFor(k);
// key present?
if (idx > 0) {
shapeMap.storage[idx] = v;
Expand Down

0 comments on commit fc315b6

Please sign in to comment.