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

Side by Side Diff: third_party/WebKit/Source/wtf/BitVector.h

Issue 2257683002: Rename WTF::bitwise_cast to WTF::bitwiseCast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 | third_party/WebKit/Source/wtf/BitVector.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 { 194 {
195 ASSERT(!(bits & (static_cast<uintptr_t>(1) << maxInlineBits()))); 195 ASSERT(!(bits & (static_cast<uintptr_t>(1) << maxInlineBits())));
196 return bits | (static_cast<uintptr_t>(1) << maxInlineBits()); 196 return bits | (static_cast<uintptr_t>(1) << maxInlineBits());
197 } 197 }
198 198
199 class WTF_EXPORT OutOfLineBits { 199 class WTF_EXPORT OutOfLineBits {
200 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 200 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
201 public: 201 public:
202 size_t numBits() const { return m_numBits; } 202 size_t numBits() const { return m_numBits; }
203 size_t numWords() const { return (m_numBits + bitsInPointer() - 1) / bit sInPointer(); } 203 size_t numWords() const { return (m_numBits + bitsInPointer() - 1) / bit sInPointer(); }
204 uintptr_t* bits() { return bitwise_cast<uintptr_t*>(this + 1); } 204 uintptr_t* bits() { return bitwiseCast<uintptr_t*>(this + 1); }
205 const uintptr_t* bits() const { return bitwise_cast<const uintptr_t*>(th is + 1); } 205 const uintptr_t* bits() const { return bitwiseCast<const uintptr_t*>(thi s + 1); }
206 206
207 static OutOfLineBits* create(size_t numBits); 207 static OutOfLineBits* create(size_t numBits);
208 208
209 static void destroy(OutOfLineBits*); 209 static void destroy(OutOfLineBits*);
210 210
211 private: 211 private:
212 OutOfLineBits(size_t numBits) 212 OutOfLineBits(size_t numBits)
213 : m_numBits(numBits) 213 : m_numBits(numBits)
214 { 214 {
215 } 215 }
216 216
217 size_t m_numBits; 217 size_t m_numBits;
218 }; 218 };
219 219
220 bool isInline() const { return m_bitsOrPointer >> maxInlineBits(); } 220 bool isInline() const { return m_bitsOrPointer >> maxInlineBits(); }
221 221
222 const OutOfLineBits* outOfLineBits() const { return bitwise_cast<const OutOf LineBits*>(m_bitsOrPointer << 1); } 222 const OutOfLineBits* outOfLineBits() const { return bitwiseCast<const OutOfL ineBits*>(m_bitsOrPointer << 1); }
223 OutOfLineBits* outOfLineBits() { return bitwise_cast<OutOfLineBits*>(m_bitsO rPointer << 1); } 223 OutOfLineBits* outOfLineBits() { return bitwiseCast<OutOfLineBits*>(m_bitsOr Pointer << 1); }
224 224
225 void resizeOutOfLine(size_t numBits); 225 void resizeOutOfLine(size_t numBits);
226 void setSlow(const BitVector& other); 226 void setSlow(const BitVector& other);
227 227
228 uintptr_t* bits() 228 uintptr_t* bits()
229 { 229 {
230 if (isInline()) 230 if (isInline())
231 return &m_bitsOrPointer; 231 return &m_bitsOrPointer;
232 return outOfLineBits()->bits(); 232 return outOfLineBits()->bits();
233 } 233 }
234 234
235 const uintptr_t* bits() const 235 const uintptr_t* bits() const
236 { 236 {
237 if (isInline()) 237 if (isInline())
238 return &m_bitsOrPointer; 238 return &m_bitsOrPointer;
239 return outOfLineBits()->bits(); 239 return outOfLineBits()->bits();
240 } 240 }
241 241
242 uintptr_t m_bitsOrPointer; 242 uintptr_t m_bitsOrPointer;
243 }; 243 };
244 244
245 } // namespace WTF 245 } // namespace WTF
246 246
247 using WTF::BitVector; 247 using WTF::BitVector;
248 248
249 #endif // BitVector_h 249 #endif // BitVector_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/BitVector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698