DataBlock.cc (6288:083a6806dd96) | DataBlock.cc (7039:bc0b6ea676b5) |
---|---|
1 | |
2/* 3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; --- 17 unchanged lines hidden (view full) --- 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30#include "mem/ruby/common/DataBlock.hh" 31 32DataBlock & 33DataBlock::operator=(const DataBlock & obj) 34{ | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 17 unchanged lines hidden (view full) --- 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include "mem/ruby/common/DataBlock.hh" 30 31DataBlock & 32DataBlock::operator=(const DataBlock & obj) 33{ |
35 if (this == &obj) { 36 // assert(false); 37 } else { 38 if (!m_alloc) 39 m_data = new uint8[RubySystem::getBlockSizeBytes()]; 40 memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes()); 41 m_alloc = true; 42 } 43 return *this; | 34 if (this == &obj) { 35 // assert(false); 36 } else { 37 if (!m_alloc) 38 m_data = new uint8[RubySystem::getBlockSizeBytes()]; 39 memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes()); 40 m_alloc = true; 41 } 42 43 return *this; |
44} | 44} |