summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2005-12-23 13:32:31 -0500
committerSteve Reinhardt <stever@eecs.umich.edu>2005-12-23 13:32:31 -0500
commit0cdcb08d908bc20f614dd164f8e43287406e81a3 (patch)
treeba6da1e59f9ca5c67c9aa067f374c77129722a52
parent627f540e3119e09747005e208daa8153b22d9967 (diff)
downloadgem5-0cdcb08d908bc20f614dd164f8e43287406e81a3.tar.xz
Change base/intmath.{cc,hh} to follow m5 style.
arch/alpha/alpha_tru64_process.cc: base/intmath.hh: base/statistics.cc: base/str.cc: cpu/o3/btb.cc: sim/process.cc: sim/syscall_emul.hh: Rename intmath.hh functions to follow m5 style (RoundUp -> roundUp, etc.). base/intmath.cc: Rename intmath.hh functions to follow m5 style (RoundUp -> roundUp, etc.). Also reindent code in m5 style. --HG-- extra : convert_revision : 57b853002bc3c9911e122599d9062b41a06d8e6a
-rw-r--r--arch/alpha/alpha_tru64_process.cc2
-rw-r--r--base/intmath.cc44
-rw-r--r--base/intmath.hh60
-rw-r--r--base/statistics.cc2
-rw-r--r--base/str.cc18
-rw-r--r--cpu/o3/btb.cc2
-rw-r--r--sim/process.cc2
-rw-r--r--sim/syscall_emul.hh2
8 files changed, 66 insertions, 66 deletions
diff --git a/arch/alpha/alpha_tru64_process.cc b/arch/alpha/alpha_tru64_process.cc
index ab8558182..b7a1c7d59 100644
--- a/arch/alpha/alpha_tru64_process.cc
+++ b/arch/alpha/alpha_tru64_process.cc
@@ -843,7 +843,7 @@ class Tru64 {
// Actual size includes padded string rounded up for alignment.
// Subtract 256 for dummy char array in Tru64::dirent definition.
// Add 1 to namelen for terminating null char.
- int tgt_bufsize = sizeof(Tru64::dirent) - 256 + RoundUp(namelen+1, 8);
+ int tgt_bufsize = sizeof(Tru64::dirent) - 256 + roundUp(namelen+1, 8);
TypedBufferArg<Tru64::dirent> tgt_dp(tgt_buf_ptr, tgt_bufsize);
tgt_dp->d_ino = host_dp->d_ino;
tgt_dp->d_reclen = tgt_bufsize;
diff --git a/base/intmath.cc b/base/intmath.cc
index 099ab1c9a..f1c1651ba 100644
--- a/base/intmath.cc
+++ b/base/intmath.cc
@@ -29,30 +29,30 @@
#include "base/intmath.hh"
int
-PrevPrime(int n)
+prevPrime(int n)
{
- int decr;
+ int decr;
- // If the number is even, let's start with the previous odd number.
- if (!(n & 1))
- --n;
+ // If the number is even, let's start with the previous odd number.
+ if (!(n & 1))
+ --n;
- // Lets test for divisibility by 3. Then we will be able to easily
- // avoid numbers that are divisible by 3 in the future.
- decr = n % 3;
- if (decr == 0) {
- n -= 2;
- decr = 2;
- }
- else if (decr == 1)
- decr = 4;
+ // Lets test for divisibility by 3. Then we will be able to easily
+ // avoid numbers that are divisible by 3 in the future.
+ decr = n % 3;
+ if (decr == 0) {
+ n -= 2;
+ decr = 2;
+ }
+ else if (decr == 1)
+ decr = 4;
- for (;;) {
- if (IsPrime(n))
- return n;
- n -= decr;
- // Toggle between 2 and 4 to prevent trying numbers that are known
- // to be divisible by 3.
- decr = 6 - decr;
- }
+ for (;;) {
+ if (isPrime(n))
+ return n;
+ n -= decr;
+ // Toggle between 2 and 4 to prevent trying numbers that are known
+ // to be divisible by 3.
+ decr = 6 - decr;
+ }
}
diff --git a/base/intmath.hh b/base/intmath.hh
index 28d47fadd..3922a326b 100644
--- a/base/intmath.hh
+++ b/base/intmath.hh
@@ -34,12 +34,12 @@
#include "sim/host.hh"
// Returns the prime number one less than n.
-int PrevPrime(int n);
+int prevPrime(int n);
// Determine if a number is prime
template <class T>
inline bool
-IsPrime(T n)
+isPrime(T n)
{
T i;
@@ -60,20 +60,20 @@ IsPrime(T n)
template <class T>
inline T
-LeastSigBit(T n)
+leastSigBit(T n)
{
return n & ~(n - 1);
}
template <class T>
inline bool
-IsPowerOf2(T n)
+isPowerOf2(T n)
{
- return n != 0 && LeastSigBit(n) == n;
+ return n != 0 && leastSigBit(n) == n;
}
inline int
-FloorLog2(unsigned x)
+floorLog2(unsigned x)
{
assert(x > 0);
@@ -89,7 +89,7 @@ FloorLog2(unsigned x)
}
inline int
-FloorLog2(unsigned long x)
+floorLog2(unsigned long x)
{
assert(x > 0);
@@ -108,7 +108,7 @@ FloorLog2(unsigned long x)
}
inline int
-FloorLog2(unsigned long long x)
+floorLog2(unsigned long long x)
{
assert(x > 0);
@@ -125,76 +125,76 @@ FloorLog2(unsigned long long x)
}
inline int
-FloorLog2(int x)
+floorLog2(int x)
{
assert(x > 0);
- return FloorLog2((unsigned)x);
+ return floorLog2((unsigned)x);
}
inline int
-FloorLog2(long x)
+floorLog2(long x)
{
assert(x > 0);
- return FloorLog2((unsigned long)x);
+ return floorLog2((unsigned long)x);
}
inline int
-FloorLog2(long long x)
+floorLog2(long long x)
{
assert(x > 0);
- return FloorLog2((unsigned long long)x);
+ return floorLog2((unsigned long long)x);
}
#if defined(__APPLE__)
inline int
-FloorLog2(size_t x)
+floorLog2(size_t x)
{
assert(x > 0);
assert(sizeof(size_t) == 4 || sizeof(size_t) == 8);
// It's my hope that this is optimized away?
if (sizeof(size_t) == 4)
- return FloorLog2((uint32_t)x);
+ return floorLog2((uint32_t)x);
else if (sizeof(size_t) == 8)
- return FloorLog2((uint64_t)x);
+ return floorLog2((uint64_t)x);
}
#endif
template <class T>
inline int
-CeilLog2(T n)
+ceilLog2(T n)
{
if (n == 1)
return 0;
- return FloorLog2(n - (T)1) + 1;
+ return floorLog2(n - (T)1) + 1;
}
template <class T>
inline T
-FloorPow2(T n)
+floorPow2(T n)
{
- return (T)1 << FloorLog2(n);
+ return (T)1 << floorLog2(n);
}
template <class T>
inline T
-CeilPow2(T n)
+ceilPow2(T n)
{
- return (T)1 << CeilLog2(n);
+ return (T)1 << ceilLog2(n);
}
template <class T>
inline T
-DivCeil(T a, T b)
+divCeil(T a, T b)
{
return (a + b - 1) / b;
}
template <class T>
inline T
-RoundUp(T val, T align)
+roundUp(T val, T align)
{
T mask = align - 1;
return (val + mask) & ~mask;
@@ -202,14 +202,14 @@ RoundUp(T val, T align)
template <class T>
inline T
-RoundDown(T val, T align)
+roundDown(T val, T align)
{
T mask = align - 1;
return val & ~mask;
}
inline bool
-IsHex(char c)
+isHex(char c)
{
return c >= '0' && c <= '9' ||
c >= 'A' && c <= 'F' ||
@@ -217,19 +217,19 @@ IsHex(char c)
}
inline bool
-IsOct(char c)
+isOct(char c)
{
return c >= '0' && c <= '7';
}
inline bool
-IsDec(char c)
+isDec(char c)
{
return c >= '0' && c <= '9';
}
inline int
-Hex2Int(char c)
+hex2Int(char c)
{
if (c >= '0' && c <= '9')
return (c - '0');
diff --git a/base/statistics.cc b/base/statistics.cc
index eaefd5f15..c97564641 100644
--- a/base/statistics.cc
+++ b/base/statistics.cc
@@ -253,7 +253,7 @@ char *
MainBin::memory(off_t off)
{
if (memsize == -1)
- memsize = CeilPow2((size_t) offset());
+ memsize = ceilPow2((size_t) offset());
if (!mem) {
mem = new char[memsize];
diff --git a/base/str.cc b/base/str.cc
index 15f44dad2..5f7f50286 100644
--- a/base/str.cc
+++ b/base/str.cc
@@ -142,7 +142,7 @@ __to_number(string value, T &retval)
int i = 0;
char c = value[i];
- if (!IsDec(c)) {
+ if (!isDec(c)) {
if (c == '-' && sign)
negative = true;
else
@@ -161,7 +161,7 @@ __to_number(string value, T &retval)
if (sign && negative)
return false;
- if (!IsOct(c)) {
+ if (!isOct(c)) {
if (c == 'X' || c == 'x') {
hex = true;
oct = false;
@@ -170,7 +170,7 @@ __to_number(string value, T &retval)
}
else
retval += c - '0';
- } else if (!IsDec(c))
+ } else if (!isDec(c))
goto multiply;
else {
if (sign && negative && c == '0')
@@ -190,18 +190,18 @@ __to_number(string value, T &retval)
for (i = 2; i <= last ; i++) {
c = value[i];
- if (!IsHex(c))
+ if (!isHex(c))
return false;
if (retval > hexmax) return false;
retval *= 16;
- retval += Hex2Int(c);
+ retval += hex2Int(c);
}
return true;
} else if (oct) {
for (i = 2; i <= last ; i++) {
c = value[i];
- if (!IsOct(c))
+ if (!isOct(c))
return false;
if (retval > octmax) return false;
@@ -213,7 +213,7 @@ __to_number(string value, T &retval)
for (i = 2; i < last ; i++) {
c = value[i];
- if (!IsDec(c))
+ if (!isDec(c))
goto multiply;
if (retval > decmax) return false;
@@ -226,7 +226,7 @@ __to_number(string value, T &retval)
}
c = value[last];
- if (IsDec(c)) {
+ if (isDec(c)) {
if (retval > decmax) return false;
bool atmax = retval == decmax;
@@ -274,7 +274,7 @@ __to_number(string value, T &retval)
mult = 0;
for (i++; i <= last; i++) {
c = value[i];
- if (!IsDec(c))
+ if (!isDec(c))
return false;
mult *= 10;
diff --git a/cpu/o3/btb.cc b/cpu/o3/btb.cc
index c2bca34ae..7671e61e2 100644
--- a/cpu/o3/btb.cc
+++ b/cpu/o3/btb.cc
@@ -52,7 +52,7 @@ DefaultBTB::DefaultBTB(unsigned _numEntries,
tagMask = (1 << tagBits) - 1;
- tagShiftAmt = instShiftAmt + FloorLog2(numEntries);
+ tagShiftAmt = instShiftAmt + floorLog2(numEntries);
}
inline
diff --git a/sim/process.cc b/sim/process.cc
index a6cf5ded7..28bc5ac3b 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -274,7 +274,7 @@ LiveProcess::LiveProcess(const string &nm, ObjectFile *objFile,
text_size = objFile->textSize();
data_base = objFile->dataBase();
data_size = objFile->dataSize() + objFile->bssSize();
- brk_point = RoundUp<uint64_t>(data_base + data_size, VMPageSize);
+ brk_point = roundUp<uint64_t>(data_base + data_size, VMPageSize);
// load object file into target memory
objFile->loadSections(memory);
diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh
index 2bd8969d7..c535b5ad6 100644
--- a/sim/syscall_emul.hh
+++ b/sim/syscall_emul.hh
@@ -634,7 +634,7 @@ mmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
if (start == 0) {
// user didn't give an address... pick one from our "mmap region"
start = p->mmap_end;
- p->mmap_end += RoundUp<Addr>(length, VMPageSize);
+ p->mmap_end += roundUp<Addr>(length, VMPageSize);
if (p->nxm_start != 0) {
//If we have an nxm space, make sure we haven't colided
assert(p->mmap_end < p->nxm_start);