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

Side by Side Diff: src/base/macros.h

Issue 663893004: Use memcpy in List::AddAll for fundamental types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed offline comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/list-inl.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_BASE_MACROS_H_ 5 #ifndef V8_BASE_MACROS_H_
6 #define V8_BASE_MACROS_H_ 6 #define V8_BASE_MACROS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return AddressFrom<T>(OffsetFrom(x) & -m); 391 return AddressFrom<T>(OffsetFrom(x) & -m);
392 } 392 }
393 393
394 394
395 // Return the smallest multiple of m which is >= x. 395 // Return the smallest multiple of m which is >= x.
396 template <typename T> 396 template <typename T>
397 inline T RoundUp(T x, intptr_t m) { 397 inline T RoundUp(T x, intptr_t m) {
398 return RoundDown<T>(static_cast<T>(x + m - 1), m); 398 return RoundDown<T>(static_cast<T>(x + m - 1), m);
399 } 399 }
400 400
401
402 namespace v8 {
403 namespace base {
404
405 // TODO(yangguo): This is a poor man's replacement for std::is_fundamental,
406 // which requires C++11. Switch to std::is_fundamental once possible.
407 template <typename T>
408 inline bool is_fundamental() {
409 return false;
410 }
411
412 template <>
413 inline bool is_fundamental<uint8_t>() {
414 return true;
415 }
416 }
417 } // namespace v8::base
418
401 #endif // V8_BASE_MACROS_H_ 419 #endif // V8_BASE_MACROS_H_
OLDNEW
« no previous file with comments | « no previous file | src/list-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698