blob: 1fa5d1fbedc7bd7e3767b4445b07b8ff1641f7c1 [file] [log] [blame]
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -07001// 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
9namespace android {
10namespace runtime {
11
12void 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