1 //===- lib/Support/StringRefMemoryObject.cpp --------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/Support/StringRefMemoryObject.h"
14 int StringRefMemoryObject::readByte(uint64_t Addr, uint8_t *Byte) const {
15 if (Addr >= Base + getExtent() || Addr < Base)
17 *Byte = Bytes[Addr - Base];
21 int StringRefMemoryObject::readBytes(uint64_t Addr,
24 uint64_t Offset = Addr - Base;
25 if (Addr >= Base + getExtent() || Offset + Size > getExtent() || Addr < Base)
27 memcpy(Buf, Bytes.data() + Offset, Size);