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

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

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
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 24 matching lines...) Expand all
35 namespace WTF { 35 namespace WTF {
36 36
37 void BitVector::setSlow(const BitVector& other) 37 void BitVector::setSlow(const BitVector& other)
38 { 38 {
39 uintptr_t newBitsOrPointer; 39 uintptr_t newBitsOrPointer;
40 if (other.isInline()) { 40 if (other.isInline()) {
41 newBitsOrPointer = other.m_bitsOrPointer; 41 newBitsOrPointer = other.m_bitsOrPointer;
42 } else { 42 } else {
43 OutOfLineBits* newOutOfLineBits = OutOfLineBits::create(other.size()); 43 OutOfLineBits* newOutOfLineBits = OutOfLineBits::create(other.size());
44 memcpy(newOutOfLineBits->bits(), other.bits(), byteCount(other.size())); 44 memcpy(newOutOfLineBits->bits(), other.bits(), byteCount(other.size()));
45 newBitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1; 45 newBitsOrPointer = bitwiseCast<uintptr_t>(newOutOfLineBits) >> 1;
46 } 46 }
47 if (!isInline()) 47 if (!isInline())
48 OutOfLineBits::destroy(outOfLineBits()); 48 OutOfLineBits::destroy(outOfLineBits());
49 m_bitsOrPointer = newBitsOrPointer; 49 m_bitsOrPointer = newBitsOrPointer;
50 } 50 }
51 51
52 void BitVector::resize(size_t numBits) 52 void BitVector::resize(size_t numBits)
53 { 53 {
54 if (numBits <= maxInlineBits()) { 54 if (numBits <= maxInlineBits()) {
55 if (isInline()) 55 if (isInline())
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } else { 101 } else {
102 if (numBits > size()) { 102 if (numBits > size()) {
103 size_t oldNumWords = outOfLineBits()->numWords(); 103 size_t oldNumWords = outOfLineBits()->numWords();
104 memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), oldNumWord s * sizeof(void*)); 104 memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), oldNumWord s * sizeof(void*));
105 memset(newOutOfLineBits->bits() + oldNumWords, 0, (newNumWords - old NumWords) * sizeof(void*)); 105 memset(newOutOfLineBits->bits() + oldNumWords, 0, (newNumWords - old NumWords) * sizeof(void*));
106 } else { 106 } else {
107 memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), newOutOfLi neBits->numWords() * sizeof(void*)); 107 memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), newOutOfLi neBits->numWords() * sizeof(void*));
108 } 108 }
109 OutOfLineBits::destroy(outOfLineBits()); 109 OutOfLineBits::destroy(outOfLineBits());
110 } 110 }
111 m_bitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1; 111 m_bitsOrPointer = bitwiseCast<uintptr_t>(newOutOfLineBits) >> 1;
112 } 112 }
113 113
114 void BitVector::dump(PrintStream& out) 114 void BitVector::dump(PrintStream& out)
115 { 115 {
116 for (size_t i = 0; i < size(); ++i) { 116 for (size_t i = 0; i < size(); ++i) {
117 if (get(i)) 117 if (get(i))
118 out.printf("1"); 118 out.printf("1");
119 else 119 else
120 out.printf("-"); 120 out.printf("-");
121 } 121 }
122 } 122 }
123 123
124 } // namespace WTF 124 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/BitVector.h ('k') | third_party/WebKit/Source/wtf/HashFunctions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698