Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h

Issue 21208003: Update protobuf to r428, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2012 Google Inc. All rights reserved. 2 // Copyright 2012 Google Inc. All rights reserved.
3 // http://code.google.com/p/protobuf/ 3 // http://code.google.com/p/protobuf/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 #ifdef __LP64__ 129 #ifdef __LP64__
130 130
131 // 64-bit implementation on 64-bit platform 131 // 64-bit implementation on 64-bit platform
132 132
133 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, 133 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
134 Atomic64 old_value, 134 Atomic64 old_value,
135 Atomic64 new_value) { 135 Atomic64 new_value) {
136 Atomic64 prev_value; 136 Atomic64 prev_value;
137 do { 137 do {
138 if (OSAtomicCompareAndSwap64(old_value, new_value, 138 if (OSAtomicCompareAndSwap64(old_value, new_value,
139 reinterpret_cast<volatile int64_t*>(ptr))) { 139 const_cast<Atomic64*>(ptr))) {
140 return old_value; 140 return old_value;
141 } 141 }
142 prev_value = *ptr; 142 prev_value = *ptr;
143 } while (prev_value == old_value); 143 } while (prev_value == old_value);
144 return prev_value; 144 return prev_value;
145 } 145 }
146 146
147 inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, 147 inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
148 Atomic64 new_value) { 148 Atomic64 new_value) {
149 Atomic64 old_value; 149 Atomic64 old_value;
150 do { 150 do {
151 old_value = *ptr; 151 old_value = *ptr;
152 } while (!OSAtomicCompareAndSwap64(old_value, new_value, 152 } while (!OSAtomicCompareAndSwap64(old_value, new_value,
153 reinterpret_cast<volatile int64_t*>(ptr))); 153 const_cast<Atomic64*>(ptr)));
154 return old_value; 154 return old_value;
155 } 155 }
156 156
157 inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, 157 inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
158 Atomic64 increment) { 158 Atomic64 increment) {
159 return OSAtomicAdd64(increment, reinterpret_cast<volatile int64_t*>(ptr)); 159 return OSAtomicAdd64(increment, const_cast<Atomic64*>(ptr));
160 } 160 }
161 161
162 inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, 162 inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
163 Atomic64 increment) { 163 Atomic64 increment) {
164 return OSAtomicAdd64Barrier(increment, 164 return OSAtomicAdd64Barrier(increment, const_cast<Atomic64*>(ptr));
165 reinterpret_cast<volatile int64_t*>(ptr));
166 } 165 }
167 166
168 inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, 167 inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
169 Atomic64 old_value, 168 Atomic64 old_value,
170 Atomic64 new_value) { 169 Atomic64 new_value) {
171 Atomic64 prev_value; 170 Atomic64 prev_value;
172 do { 171 do {
173 if (OSAtomicCompareAndSwap64Barrier( 172 if (OSAtomicCompareAndSwap64Barrier(old_value, new_value,
174 old_value, new_value, reinterpret_cast<volatile int64_t*>(ptr))) { 173 const_cast<Atomic64*>(ptr))) {
175 return old_value; 174 return old_value;
176 } 175 }
177 prev_value = *ptr; 176 prev_value = *ptr;
178 } while (prev_value == old_value); 177 } while (prev_value == old_value);
179 return prev_value; 178 return prev_value;
180 } 179 }
181 180
182 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, 181 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
183 Atomic64 old_value, 182 Atomic64 old_value,
184 Atomic64 new_value) { 183 Atomic64 new_value) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return *ptr; 215 return *ptr;
217 } 216 }
218 217
219 #endif // defined(__LP64__) 218 #endif // defined(__LP64__)
220 219
221 } // namespace internal 220 } // namespace internal
222 } // namespace protobuf 221 } // namespace protobuf
223 } // namespace google 222 } // namespace google
224 223
225 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_MACOSX_H_ 224 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_MACOSX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698