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

Side by Side Diff: src/base/atomic-utils.h

Issue 2496913002: Fix more -Wsign-compare warnings in heap, mips, base, etc. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | src/cancelable-task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project 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 #ifndef V8_ATOMIC_UTILS_H_ 5 #ifndef V8_ATOMIC_UTILS_H_
6 #define V8_ATOMIC_UTILS_H_ 6 #define V8_ATOMIC_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 9
10 #include "src/base/atomicops.h" 10 #include "src/base/atomicops.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 V8_INLINE bool TrySetValue(T old_value, T new_value) { 122 V8_INLINE bool TrySetValue(T old_value, T new_value) {
123 return base::Release_CompareAndSwap( 123 return base::Release_CompareAndSwap(
124 &value_, cast_helper<T>::to_storage_type(old_value), 124 &value_, cast_helper<T>::to_storage_type(old_value),
125 cast_helper<T>::to_storage_type(new_value)) == 125 cast_helper<T>::to_storage_type(new_value)) ==
126 cast_helper<T>::to_storage_type(old_value); 126 cast_helper<T>::to_storage_type(old_value);
127 } 127 }
128 128
129 V8_INLINE void SetBits(T bits, T mask) { 129 V8_INLINE void SetBits(T bits, T mask) {
130 DCHECK_EQ(bits & ~mask, 0); 130 DCHECK_EQ(bits & ~mask, static_cast<T>(0));
131 T old_value; 131 T old_value;
132 T new_value; 132 T new_value;
133 do { 133 do {
134 old_value = Value(); 134 old_value = Value();
135 new_value = (old_value & ~mask) | bits; 135 new_value = (old_value & ~mask) | bits;
136 } while (!TrySetValue(old_value, new_value)); 136 } while (!TrySetValue(old_value, new_value));
137 } 137 }
138 138
139 V8_INLINE void SetBit(int bit) { 139 V8_INLINE void SetBit(int bit) {
140 SetBits(static_cast<T>(1) << bit, static_cast<T>(1) << bit); 140 SetBits(static_cast<T>(1) << bit, static_cast<T>(1) << bit);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return static_cast<base::AtomicWord>(1) << element; 245 return static_cast<base::AtomicWord>(1) << element;
246 } 246 }
247 247
248 base::AtomicWord bits_; 248 base::AtomicWord bits_;
249 }; 249 };
250 250
251 } // namespace base 251 } // namespace base
252 } // namespace v8 252 } // namespace v8
253 253
254 #endif // #define V8_ATOMIC_UTILS_H_ 254 #endif // #define V8_ATOMIC_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | src/cancelable-task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698