Fix emulator build error
[platform/framework/web/chromium-efl.git] / base / atomicops_internals_atomicword_compat.h
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file is an internal atomic implementation, use base/atomicops.h instead.
6
7 #ifndef BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
8 #define BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_
9
10 #include <stdint.h>
11
12 #include "build/build_config.h"
13
14 // AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32_t,
15 // which in turn means int. On some LP32 platforms, intptr_t is an int, but
16 // on others, it's a long. When AtomicWord and Atomic32 are based on different
17 // fundamental types, their pointers are incompatible.
18 //
19 // This file defines function overloads to allow both AtomicWord and Atomic32
20 // data to be used with this interface.
21 //
22 // On LP64 platforms, AtomicWord and Atomic64 are both always long,
23 // so this problem doesn't occur.
24
25 #if !defined(ARCH_CPU_64_BITS)
26
27 namespace base {
28 namespace subtle {
29
30 inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr,
31                                            AtomicWord old_value,
32                                            AtomicWord new_value) {
33   return NoBarrier_CompareAndSwap(
34       reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
35 }
36
37 inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr,
38                                            AtomicWord new_value) {
39   return NoBarrier_AtomicExchange(
40       reinterpret_cast<volatile Atomic32*>(ptr), new_value);
41 }
42
43 inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr,
44                                             AtomicWord increment) {
45   return NoBarrier_AtomicIncrement(
46       reinterpret_cast<volatile Atomic32*>(ptr), increment);
47 }
48
49 inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr,
50                                           AtomicWord increment) {
51   return Barrier_AtomicIncrement(
52       reinterpret_cast<volatile Atomic32*>(ptr), increment);
53 }
54
55 inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
56                                          AtomicWord old_value,
57                                          AtomicWord new_value) {
58   return base::subtle::Acquire_CompareAndSwap(
59       reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
60 }
61
62 inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
63                                          AtomicWord old_value,
64                                          AtomicWord new_value) {
65   return base::subtle::Release_CompareAndSwap(
66       reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
67 }
68
69 inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) {
70   NoBarrier_Store(
71       reinterpret_cast<volatile Atomic32*>(ptr), value);
72 }
73
74 inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
75   return base::subtle::Release_Store(
76       reinterpret_cast<volatile Atomic32*>(ptr), value);
77 }
78
79 inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) {
80   return NoBarrier_Load(
81       reinterpret_cast<volatile const Atomic32*>(ptr));
82 }
83
84 inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
85   return base::subtle::Acquire_Load(
86       reinterpret_cast<volatile const Atomic32*>(ptr));
87 }
88
89 }  // namespace subtle
90 }  // namespace base
91
92 #endif  // !defined(ARCH_CPU_64_BITS)
93
94 #endif  // BASE_ATOMICOPS_INTERNALS_ATOMICWORD_COMPAT_H_