Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame^] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <string.h> |
| 5 | #include "src/globals.h" |
| 6 | #include "src/logging.h" |
| 7 | #include "src/memory_region.h" |
| 8 | |
| 9 | namespace android { |
| 10 | namespace runtime { |
| 11 | |
| 12 | void MemoryRegion::CopyFrom(size_t offset, const MemoryRegion& from) const { |
| 13 | CHECK_NE(from.pointer(), NULL); |
| 14 | CHECK_GT(from.size(), 0); |
| 15 | CHECK_GE(this->size(), from.size()); |
| 16 | CHECK_LE(offset, this->size() - from.size()); |
| 17 | memmove(reinterpret_cast<void*>(start() + offset), |
| 18 | from.pointer(), from.size()); |
| 19 | } |
| 20 | |
| 21 | } } // namespace android::runtime |