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

Unified Diff: src/v8utils.h

Issue 13470008: Fix CopyBytes to accept size_t for num_bytes (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« src/heap.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8utils.h
diff --git a/src/v8utils.h b/src/v8utils.h
index 606d8e7f404dc0e82b52cbde0b64a3d6b2835175..b5c8f084e02b95785e177846b70e8c4c9fe97612 100644
--- a/src/v8utils.h
+++ b/src/v8utils.h
@@ -151,20 +151,19 @@ inline void CopyWords(T* dst, T* src, int num_words) {
// Copies data from |src| to |dst|. The data spans must not overlap.
template <typename T>
-inline void CopyBytes(T* dst, T* src, int num_bytes) {
+inline void CopyBytes(T* dst, T* src, size_t num_bytes) {
STATIC_ASSERT(sizeof(T) == 1);
ASSERT(Min(dst, src) + num_bytes <= Max(dst, src));
- ASSERT(num_bytes >= 0);
if (num_bytes == 0) return;
// Use block copying OS::MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.
static const int kBlockCopyLimit = OS::kMinComplexMemCopy;
- if (num_bytes >= kBlockCopyLimit) {
+ if (num_bytes >= static_cast<size_t>(kBlockCopyLimit)) {
OS::MemCopy(dst, src, num_bytes);
} else {
- int remaining = num_bytes;
+ size_t remaining = num_bytes;
do {
remaining--;
*dst++ = *src++;
« src/heap.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698