TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
atomicops_internals_atomicword_compat.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2012 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // This file is an internal atomic implementation, use atomicops.h instead.
32 
33 #ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
34 #define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
35 
36 // AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32,
37 // which in turn means int. On some LP32 platforms, intptr_t is an int, but
38 // on others, it's a long. When AtomicWord and Atomic32 are based on different
39 // fundamental types, their pointers are incompatible.
40 //
41 // This file defines function overloads to allow both AtomicWord and Atomic32
42 // data to be used with this interface.
43 //
44 // On LP64 platforms, AtomicWord and Atomic64 are both always long,
45 // so this problem doesn't occur.
46 
47 #if !defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
48 
49 namespace google {
50 namespace protobuf {
51 namespace internal {
52 
54  AtomicWord old_value,
55  AtomicWord new_value) {
57  reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
58 }
59 
61  AtomicWord new_value) {
63  reinterpret_cast<volatile Atomic32*>(ptr), new_value);
64 }
65 
67  AtomicWord increment) {
69  reinterpret_cast<volatile Atomic32*>(ptr), increment);
70 }
71 
73  AtomicWord increment) {
75  reinterpret_cast<volatile Atomic32*>(ptr), increment);
76 }
77 
79  AtomicWord old_value,
80  AtomicWord new_value) {
82  reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
83 }
84 
86  AtomicWord old_value,
87  AtomicWord new_value) {
89  reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
90 }
91 
92 inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) {
93  NoBarrier_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
94 }
95 
96 inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
97  return Acquire_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
98 }
99 
100 inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
101  return Release_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
102 }
103 
104 inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) {
105  return NoBarrier_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
106 }
107 
108 inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
109  return Acquire_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
110 }
111 
112 inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
113  return Release_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
114 }
115 
116 } // namespace internal
117 } // namespace protobuf
118 } // namespace google
119 
120 #endif // !defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
121 
122 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
Atomic32 Acquire_Load(volatile const Atomic32 *ptr)
Definition: atomicops_internals_arm64_gcc.h:167
void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value)
Definition: atomicops_internals_arm64_gcc.h:149
Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
Definition: atomicops_internals_arm64_gcc.h:52
void Release_Store(volatile Atomic32 *ptr, Atomic32 value)
Definition: atomicops_internals_arm64_gcc.h:154
Atomic32 Release_Load(volatile const Atomic32 *ptr)
Definition: atomicops_internals_arm64_gcc.h:180
Definition: document.h:390
intptr_t AtomicWord
Definition: atomicops.h:81
Atomic32 Release_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
Definition: atomicops_internals_arm64_gcc.h:136
Atomic32 Barrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)
Definition: atomicops_internals_arm64_gcc.h:118
Definition: BnetFileGenerator.h:47
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)
Definition: atomicops_internals_arm64_gcc.h:97
const FieldDescriptor value
Definition: descriptor.h:1522
Atomic32 NoBarrier_AtomicExchange(volatile Atomic32 *ptr, Atomic32 new_value)
Definition: atomicops_internals_arm64_gcc.h:77
void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value)
Definition: atomicops_internals_arm64_gcc.h:145
Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr)
Definition: atomicops_internals_arm64_gcc.h:163
Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
Definition: atomicops_internals_arm64_gcc.h:127