OLD | NEW |
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 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { | 75 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { |
76 return *ptr; | 76 return *ptr; |
77 } | 77 } |
78 | 78 |
79 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { | 79 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { |
80 Atomic32 value = *ptr; | 80 Atomic32 value = *ptr; |
81 return value; | 81 return value; |
82 } | 82 } |
83 | 83 |
84 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { | 84 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { |
85 MemoryBarrierInternal(); | 85 MemoryBarrier(); |
86 return *ptr; | 86 return *ptr; |
87 } | 87 } |
88 | 88 |
89 #if defined(_WIN64) | 89 #if defined(_WIN64) |
90 | 90 |
91 // 64-bit low-level operations on 64-bit platform. | 91 // 64-bit low-level operations on 64-bit platform. |
92 | 92 |
93 inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, | 93 inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, |
94 Atomic64 increment) { | 94 Atomic64 increment) { |
95 return Barrier_AtomicIncrement(ptr, increment); | 95 return Barrier_AtomicIncrement(ptr, increment); |
(...skipping 22 matching lines...) Expand all Loading... |
118 inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { | 118 inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { |
119 return *ptr; | 119 return *ptr; |
120 } | 120 } |
121 | 121 |
122 inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { | 122 inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { |
123 Atomic64 value = *ptr; | 123 Atomic64 value = *ptr; |
124 return value; | 124 return value; |
125 } | 125 } |
126 | 126 |
127 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { | 127 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { |
128 MemoryBarrierInternal(); | 128 MemoryBarrier(); |
129 return *ptr; | 129 return *ptr; |
130 } | 130 } |
131 | 131 |
132 inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, | 132 inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, |
133 Atomic64 old_value, | 133 Atomic64 old_value, |
134 Atomic64 new_value) { | 134 Atomic64 new_value) { |
135 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 135 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
136 } | 136 } |
137 | 137 |
138 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, | 138 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, |
139 Atomic64 old_value, | 139 Atomic64 old_value, |
140 Atomic64 new_value) { | 140 Atomic64 new_value) { |
141 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 141 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
142 } | 142 } |
143 | 143 |
144 #endif // defined(_WIN64) | 144 #endif // defined(_WIN64) |
145 | 145 |
146 } // namespace internal | 146 } // namespace internal |
147 } // namespace protobuf | 147 } // namespace protobuf |
148 } // namespace google | 148 } // namespace google |
149 | 149 |
150 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_ | 150 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_MSVC_H_ |
OLD | NEW |