style: eliminate equality tests with true and false

Using '== true' in a boolean expression is totally redundant,
and using '== false' is pretty verbose (and arguably less
readable in most cases) compared to '!'.

It's somewhat of a pet peeve, perhaps, but I had some time
waiting for some tests to run and decided to clean these up.

Unfortunately, SLICC appears not to have the '!' operator,
so I had to leave the '== false' tests in the SLICC code.
This commit is contained in:
Steve Reinhardt
2014-05-31 18:00:23 -07:00
parent 2a8088f5ae
commit 0be64ffe2f
24 changed files with 49 additions and 50 deletions

View File

@@ -184,7 +184,7 @@ TLB::insertAt(PTE &pte, unsigned Index, int _smallPages)
(pte.D0 << 2) | (pte.V0 <<1) | pte.G),
((pte.PFN1 <<6) | (pte.C1 << 3) |
(pte.D1 << 2) | (pte.V1 <<1) | pte.G));
if (table[Index].V0 == true || table[Index].V1 == true) {
if (table[Index].V0 || table[Index].V1) {
// Previous entry is valid
PageTable::iterator i = lookupTable.find(table[Index].VPN);
lookupTable.erase(i);

View File

@@ -165,7 +165,7 @@ TLB::insertAt(PowerISA::PTE &pte, unsigned Index, int _smallPages)
} else {
// Update TLB
if (table[Index].V0 == true || table[Index].V1 == true) {
if (table[Index].V0 || table[Index].V1) {
// Previous entry is valid
PageTable::iterator i = lookupTable.find(table[Index].VPN);

View File

@@ -290,7 +290,7 @@ TLB::demapContext(int partition_id, int context_id)
for (int x = 0; x < size; x++) {
if (tlb[x].range.contextId == context_id &&
tlb[x].range.partitionId == partition_id) {
if (tlb[x].valid == true) {
if (tlb[x].valid) {
freeList.push_front(&tlb[x]);
}
tlb[x].valid = false;
@@ -329,7 +329,7 @@ TLB::flushAll()
lookupTable.clear();
for (int x = 0; x < size; x++) {
if (tlb[x].valid == true)
if (tlb[x].valid)
freeList.push_back(&tlb[x]);
tlb[x].valid = false;
tlb[x].used = false;

View File

@@ -233,7 +233,7 @@ Fault
Walker::WalkerState::startWalk()
{
Fault fault = NoFault;
assert(started == false);
assert(!started);
started = true;
setupWalk(req->getVaddr());
if (timing) {
@@ -262,7 +262,7 @@ Fault
Walker::WalkerState::startFunctional(Addr &addr, unsigned &logBytes)
{
Fault fault = NoFault;
assert(started == false);
assert(!started);
started = true;
setupWalk(addr);