Bug 1020118 - fix atomic add/sub for pointer types on Win64; r=jcranmer
authorNathan Froyd <froydnj@mozilla.com>
Wed, 04 Jun 2014 15:19:51 -0400
changeset 206470 5ba654b54620ad47e37e33c2d03763d70fd0d692
parent 206469 a8d88faf925bcd39e0cfe7a5cd33bd83a0fb8ffe
child 206471 5134fc8815bdb1b50423f5814669b8c8a1308407
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1020118
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1020118 - fix atomic add/sub for pointer types on Win64; r=jcranmer
mfbt/Atomics.h
--- a/mfbt/Atomics.h
+++ b/mfbt/Atomics.h
@@ -865,23 +865,23 @@ struct IntrinsicAddSub : public Intrinsi
 template<typename T>
 struct IntrinsicAddSub<T*> : public IntrinsicApplyHelper<T*>
 {
   typedef typename IntrinsicApplyHelper<T*>::ValueType ValueType;
 
   static ValueType add(ValueType& aPtr, ptrdiff_t aAmount)
   {
     return applyBinaryFunction(&Primitives::add, aPtr,
-                               (ValueType)(aAmount * sizeof(ValueType)));
+                               (ValueType)(aAmount * sizeof(T)));
   }
 
   static ValueType sub(ValueType& aPtr, ptrdiff_t aAmount)
   {
     return applyBinaryFunction(&Primitives::sub, aPtr,
-                               (ValueType)(aAmount * sizeof(ValueType)));
+                               (ValueType)(aAmount * sizeof(T)));
   }
 };
 
 template<typename T>
 struct IntrinsicIncDec : public IntrinsicAddSub<T>
 {
   typedef typename IntrinsicAddSub<T>::ValueType ValueType;
   static ValueType inc(ValueType& aPtr) { return add(aPtr, 1); }