ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/DoubleAdder.java
(Generate patch)

Comparing jsr166/src/jsr166e/DoubleAdder.java (file contents):
Revision 1.10 by jsr166, Mon Jan 14 20:30:22 2013 UTC vs.
Revision 1.12 by jsr166, Mon May 5 20:20:15 2014 UTC

# Line 5 | Line 5
5   */
6  
7   package jsr166e;
8 +
9 + import java.io.IOException;
10 + import java.io.ObjectInputStream;
11 + import java.io.ObjectOutputStream;
12   import java.io.Serializable;
13  
14   /**
# Line 59 | Line 63 | public class DoubleAdder extends Striped
63       * @param x the value to add
64       */
65      public void add(double x) {
66 <        Cell[] as; long b, v; HashCode hc; Cell a; int n;
66 >        Cell[] as; long b, v; int[] hc; Cell a; int n;
67          if ((as = cells) != null ||
68              !casBase(b = base,
69                       Double.doubleToRawLongBits
70                       (Double.longBitsToDouble(b) + x))) {
71              boolean uncontended = true;
72 <            int h = (hc = threadHashCode.get()).code;
73 <            if (as == null || (n = as.length) < 1 ||
74 <                (a = as[(n - 1) & h]) == null ||
72 >            if ((hc = threadHashCode.get()) == null ||
73 >                as == null || (n = as.length) < 1 ||
74 >                (a = as[(n - 1) & hc[0]]) == null ||
75                  !(uncontended = a.cas(v = a.value,
76                                        Double.doubleToRawLongBits
77                                        (Double.longBitsToDouble(v) + x))))
# Line 181 | Line 185 | public class DoubleAdder extends Striped
185          return (float)sum();
186      }
187  
188 <    private void writeObject(java.io.ObjectOutputStream s)
185 <        throws java.io.IOException {
188 >    private void writeObject(ObjectOutputStream s) throws IOException {
189          s.defaultWriteObject();
190          s.writeDouble(sum());
191      }
192  
193 <    private void readObject(java.io.ObjectInputStream s)
194 <        throws java.io.IOException, ClassNotFoundException {
193 >    private void readObject(ObjectInputStream s)
194 >            throws IOException, ClassNotFoundException {
195          s.defaultReadObject();
196          busy = 0;
197          cells = null;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines