blob: 987db51807f85bea0da9238a41d321ae058cc4b0 [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>
Brian Carlstrom578bbdc2011-07-21 14:07:47 -07005#include "globals.h"
6#include "logging.h"
7#include "memory_region.h"
Carl Shapiroa5d5cfd2011-06-21 12:46:59 -07008
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