equal
deleted
inserted
replaced
69 * for longs. Called only once and cached in VM_SUPPORTS_LONG_CAS. |
69 * for longs. Called only once and cached in VM_SUPPORTS_LONG_CAS. |
70 */ |
70 */ |
71 private static native boolean VMSupportsCS8(); |
71 private static native boolean VMSupportsCS8(); |
72 |
72 |
73 static { |
73 static { |
74 try { |
74 try { |
75 valueOffset = unsafe.objectFieldOffset |
75 valueOffset = unsafe.objectFieldOffset |
76 (AtomicLong.class.getDeclaredField("value")); |
76 (AtomicLong.class.getDeclaredField("value")); |
77 } catch (Exception ex) { throw new Error(ex); } |
77 } catch (Exception ex) { throw new Error(ex); } |
78 } |
78 } |
79 |
79 |
80 private volatile long value; |
80 private volatile long value; |
81 |
81 |
82 /** |
82 /** |
268 public int intValue() { |
268 public int intValue() { |
269 return (int)get(); |
269 return (int)get(); |
270 } |
270 } |
271 |
271 |
272 /** |
272 /** |
273 * Returns the value of this {@code AtomicLong} as a {@code long} |
273 * Returns the value of this {@code AtomicLong} as a {@code long}. |
274 * value. |
|
275 */ |
274 */ |
276 public long longValue() { |
275 public long longValue() { |
277 return get(); |
276 return get(); |
278 } |
277 } |
279 |
278 |
285 public float floatValue() { |
284 public float floatValue() { |
286 return (float)get(); |
285 return (float)get(); |
287 } |
286 } |
288 |
287 |
289 /** |
288 /** |
290 * Returns the value of this {@code AtomicLong} as a {@code |
289 * Returns the value of this {@code AtomicLong} as a {@code double} |
291 * double} after a widening primitive conversion. |
290 * after a widening primitive conversion. |
292 * @jls 5.1.2 Widening Primitive Conversions |
291 * @jls 5.1.2 Widening Primitive Conversions |
293 */ |
292 */ |
294 public double doubleValue() { |
293 public double doubleValue() { |
295 return (double)get(); |
294 return (double)get(); |
296 } |
295 } |