| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file is an internal atomic implementation, use base/atomicops.h instead. | 5 // This file is an internal atomic implementation, use base/atomicops.h instead. |
| 6 | 6 |
| 7 #ifndef BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_ | 7 #ifndef BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_ |
| 8 #define BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_ | 8 #define BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_ |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { | 103 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { |
| 104 MemoryBarrier(); | 104 MemoryBarrier(); |
| 105 return *ptr; | 105 return *ptr; |
| 106 } | 106 } |
| 107 | 107 |
| 108 #if defined(_WIN64) | 108 #if defined(_WIN64) |
| 109 | 109 |
| 110 // 64-bit low-level operations on 64-bit platform. | 110 // 64-bit low-level operations on 64-bit platform. |
| 111 | 111 |
| 112 COMPILE_ASSERT(sizeof(Atomic64) == sizeof(PVOID), atomic_word_is_atomic); | 112 static_assert(sizeof(Atomic64) == sizeof(PVOID), "atomic word is atomic"); |
| 113 | 113 |
| 114 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, | 114 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
| 115 Atomic64 old_value, | 115 Atomic64 old_value, |
| 116 Atomic64 new_value) { | 116 Atomic64 new_value) { |
| 117 PVOID result = InterlockedCompareExchangePointer( | 117 PVOID result = InterlockedCompareExchangePointer( |
| 118 reinterpret_cast<volatile PVOID*>(ptr), | 118 reinterpret_cast<volatile PVOID*>(ptr), |
| 119 reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value)); | 119 reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value)); |
| 120 return reinterpret_cast<Atomic64>(result); | 120 return reinterpret_cast<Atomic64>(result); |
| 121 } | 121 } |
| 122 | 122 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 186 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 #endif // defined(_WIN64) | 190 #endif // defined(_WIN64) |
| 191 | 191 |
| 192 } // namespace subtle | 192 } // namespace subtle |
| 193 } // namespace base | 193 } // namespace base |
| 194 | 194 |
| 195 #endif // BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_ | 195 #endif // BASE_ATOMICOPS_INTERNALS_X86_MSVC_H_ |
| OLD | NEW |