blob: 30d61edc7895bb216a3b7357da1b7ef0cd80e1e7 [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
Carl Shapiro6b6b5f02011-06-21 15:05:09 -07009namespace art {
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070010
11void MemoryRegion::CopyFrom(size_t offset, const MemoryRegion& from) const {
Elliott Hughes1f359b02011-07-17 14:27:17 -070012 CHECK(from.pointer() != NULL);
13 CHECK_GT(from.size(), 0U);
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -070014 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 Shapiro6b6b5f02011-06-21 15:05:09 -070020} // namespace art