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
// 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;
#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;
+ }
}
#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;
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);
}
inline int
-FloorLog2(unsigned long x)
+floorLog2(unsigned long x)
{
assert(x > 0);
}
inline int
-FloorLog2(unsigned long long x)
+floorLog2(unsigned long long x)
{
assert(x > 0);
}
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;
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' ||
}
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');
MainBin::memory(off_t off)
{
if (memsize == -1)
- memsize = CeilPow2((size_t) offset());
+ memsize = ceilPow2((size_t) offset());
if (!mem) {
mem = new char[memsize];
int i = 0;
char c = value[i];
- if (!IsDec(c)) {
+ if (!isDec(c)) {
if (c == '-' && sign)
negative = true;
else
if (sign && negative)
return false;
- if (!IsOct(c)) {
+ if (!isOct(c)) {
if (c == 'X' || c == 'x') {
hex = true;
oct = false;
}
else
retval += c - '0';
- } else if (!IsDec(c))
+ } else if (!isDec(c))
goto multiply;
else {
if (sign && negative && c == '0')
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;
for (i = 2; i < last ; i++) {
c = value[i];
- if (!IsDec(c))
+ if (!isDec(c))
goto multiply;
if (retval > decmax) return false;
}
c = value[last];
- if (IsDec(c)) {
+ if (isDec(c)) {
if (retval > decmax) return false;
bool atmax = retval == decmax;
mult = 0;
for (i++; i <= last; i++) {
c = value[i];
- if (!IsDec(c))
+ if (!isDec(c))
return false;
mult *= 10;
tagMask = (1 << tagBits) - 1;
- tagShiftAmt = instShiftAmt + FloorLog2(numEntries);
+ tagShiftAmt = instShiftAmt + floorLog2(numEntries);
}
inline
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);
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);