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 207554 5ba654b54620ad47e37e33c2d03763d70fd0d692
parent 207553 a8d88faf925bcd39e0cfe7a5cd33bd83a0fb8ffe
child 207555 5134fc8815bdb1b50423f5814669b8c8a1308407
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [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); }