summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-09-11 09:23:56 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-09-11 09:23:56 -0500
commitf00347a20fca8bbb0a955723bf068e23fe66f170 (patch)
tree5af847871374784d1f038a4ddb25755ba5d56edf /src/mem/ruby/common
parent5cdf221d8ce3f5b983672f26346aefc21b37a752 (diff)
downloadgem5-f00347a20fca8bbb0a955723bf068e23fe66f170.tar.xz
Ruby: Use uint8_t instead of uint8 everywhere
Diffstat (limited to 'src/mem/ruby/common')
-rw-r--r--src/mem/ruby/common/DataBlock.cc8
-rw-r--r--src/mem/ruby/common/DataBlock.hh22
-rw-r--r--src/mem/ruby/common/SubBlock.hh8
-rw-r--r--src/mem/ruby/common/TypeDefines.hh2
4 files changed, 19 insertions, 21 deletions
diff --git a/src/mem/ruby/common/DataBlock.cc b/src/mem/ruby/common/DataBlock.cc
index 59a0f692a..c71449dd0 100644
--- a/src/mem/ruby/common/DataBlock.cc
+++ b/src/mem/ruby/common/DataBlock.cc
@@ -31,7 +31,7 @@
DataBlock::DataBlock(const DataBlock &cp)
{
- m_data = new uint8[RubySystem::getBlockSizeBytes()];
+ m_data = new uint8_t[RubySystem::getBlockSizeBytes()];
memcpy(m_data, cp.m_data, RubySystem::getBlockSizeBytes());
m_alloc = true;
}
@@ -39,7 +39,7 @@ DataBlock::DataBlock(const DataBlock &cp)
void
DataBlock::alloc()
{
- m_data = new uint8[RubySystem::getBlockSizeBytes()];
+ m_data = new uint8_t[RubySystem::getBlockSizeBytes()];
m_alloc = true;
clear();
}
@@ -70,7 +70,7 @@ DataBlock::print(std::ostream& out) const
out << dec << "]" << flush;
}
-const uint8*
+const uint8_t*
DataBlock::getData(int offset, int len) const
{
assert(offset + len <= RubySystem::getBlockSizeBytes());
@@ -78,7 +78,7 @@ DataBlock::getData(int offset, int len) const
}
void
-DataBlock::setData(uint8* data, int offset, int len)
+DataBlock::setData(uint8_t *data, int offset, int len)
{
assert(offset + len <= RubySystem::getBlockSizeBytes());
memcpy(&m_data[offset], data, len);
diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh
index 0ab4cfc01..56320523b 100644
--- a/src/mem/ruby/common/DataBlock.hh
+++ b/src/mem/ruby/common/DataBlock.hh
@@ -29,12 +29,12 @@
#ifndef __MEM_RUBY_COMMON_DATABLOCK_HH__
#define __MEM_RUBY_COMMON_DATABLOCK_HH__
+#include <inttypes.h>
+
#include <cassert>
#include <iomanip>
#include <iostream>
-#include "mem/ruby/common/TypeDefines.hh"
-
class DataBlock
{
public:
@@ -53,25 +53,25 @@ class DataBlock
DataBlock& operator=(const DataBlock& obj);
- void assign(uint8* data);
+ void assign(uint8_t *data);
void clear();
- uint8 getByte(int whichByte) const;
- const uint8* getData(int offset, int len) const;
- void setByte(int whichByte, uint8 data);
- void setData(uint8* data, int offset, int len);
+ uint8_t getByte(int whichByte) const;
+ const uint8_t *getData(int offset, int len) const;
+ void setByte(int whichByte, uint8_t data);
+ void setData(uint8_t *data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const;
void print(std::ostream& out) const;
private:
void alloc();
- uint8* m_data;
+ uint8_t *m_data;
bool m_alloc;
};
inline void
-DataBlock::assign(uint8* data)
+DataBlock::assign(uint8_t *data)
{
assert(data != NULL);
if (m_alloc) {
@@ -81,14 +81,14 @@ DataBlock::assign(uint8* data)
m_alloc = false;
}
-inline uint8
+inline uint8_t
DataBlock::getByte(int whichByte) const
{
return m_data[whichByte];
}
inline void
-DataBlock::setByte(int whichByte, uint8 data)
+DataBlock::setByte(int whichByte, uint8_t data)
{
m_data[whichByte] = data;
}
diff --git a/src/mem/ruby/common/SubBlock.hh b/src/mem/ruby/common/SubBlock.hh
index 3ebc99630..6edb82ecc 100644
--- a/src/mem/ruby/common/SubBlock.hh
+++ b/src/mem/ruby/common/SubBlock.hh
@@ -48,12 +48,12 @@ class SubBlock
int getSize() const { return m_data.size(); }
void resize(int size) { m_data.resize(size); }
- uint8 getByte(int offset) const { return m_data[offset]; }
- void setByte(int offset, uint8 data) { m_data[offset] = data; }
+ uint8_t getByte(int offset) const { return m_data[offset]; }
+ void setByte(int offset, uint8_t data) { m_data[offset] = data; }
// Shorthands
- uint8 readByte() const { return getByte(0); }
- void writeByte(uint8 data) { setByte(0, data); }
+ uint8_t readByte() const { return getByte(0); }
+ void writeByte(uint8_t data) { setByte(0, data); }
// Merging to and from DataBlocks - We only need to worry about
// updates when we are using DataBlocks
diff --git a/src/mem/ruby/common/TypeDefines.hh b/src/mem/ruby/common/TypeDefines.hh
index a7b8a6101..3923c6b85 100644
--- a/src/mem/ruby/common/TypeDefines.hh
+++ b/src/mem/ruby/common/TypeDefines.hh
@@ -30,8 +30,6 @@
#ifndef TYPEDEFINES_H
#define TYPEDEFINES_H
-
-typedef unsigned char uint8;
typedef unsigned int uint32;
typedef unsigned long long uint64;