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> |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 5 | #include "globals.h" |
| 6 | #include "logging.h" |
| 7 | #include "memory_region.h" |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 8 | |
Carl Shapiro | 6b6b5f0 | 2011-06-21 15:05:09 -0700 | [diff] [blame] | 9 | namespace art { |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 10 | |
| 11 | void MemoryRegion::CopyFrom(size_t offset, const MemoryRegion& from) const { |
Elliott Hughes | 1f359b0 | 2011-07-17 14:27:17 -0700 | [diff] [blame] | 12 | CHECK(from.pointer() != NULL); |
| 13 | CHECK_GT(from.size(), 0U); |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 14 | CHECK_GE(this->size(), from.size()); |
| 15 | CHECK_LE(offset, this->size() - from.size()); |
| 16 | memmove(reinterpret_cast<void*>(start() + offset), |
| 17 | from.pointer(), from.size()); |
| 18 | } |
| 19 | |
Carl Shapiro | 6b6b5f0 | 2011-06-21 15:05:09 -0700 | [diff] [blame] | 20 | } // namespace art |