The Road to Clang-Format part 1
Whitespace: The Darkening
Change-Id: I9c0c355ddf22f9b27763c97e3e85079c135ae7a7
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/register/hei_hardware_register.cpp b/src/register/hei_hardware_register.cpp
index 3334662..52dc28c 100755
--- a/src/register/hei_hardware_register.cpp
+++ b/src/register/hei_hardware_register.cpp
@@ -13,7 +13,7 @@
//------------------------------------------------------------------------------
#if 0
-void HardwareRegister::setBitString( const BitString *bs )
+void HardwareRegister::setBitString(const BitString *bs)
{
BitString & l_string = accessBitString();
l_string.setString(*bs);
@@ -22,10 +22,10 @@
//------------------------------------------------------------------------------
-const BitString * HardwareRegister::getBitString( const Chip & i_chip ) const
+const BitString * HardwareRegister::getBitString(const Chip & i_chip) const
{
// Verify this register belongs on i_chip.
- verifyAccessorChip( i_chip );
+ verifyAccessorChip(i_chip);
// Calling read() will ensure that an entry exists in the cache and the
// entry has at been synched with hardware at least once. Note that we
@@ -33,21 +33,21 @@
// will be created in the cache, if it does not exist, when the cache is
// accessed below.
- if ( ( REG_ACCESS_NONE != getAccessLevel() ) &&
- ( REG_ACCESS_WO != getAccessLevel() ) )
+ if ((REG_ACCESS_NONE != getAccessLevel()) &&
+ (REG_ACCESS_WO != getAccessLevel()))
{
- read( i_chip );
+ read(i_chip);
}
- return &( accessCache(i_chip) );
+ return &(accessCache(i_chip));
}
//------------------------------------------------------------------------------
-BitString & HardwareRegister::accessBitString( const Chip & i_chip )
+BitString & HardwareRegister::accessBitString(const Chip & i_chip)
{
// Verify this register belongs on i_chip.
- verifyAccessorChip( i_chip );
+ verifyAccessorChip(i_chip);
// Calling read() will ensure that an entry exists in the cache and the
// entry has at been synched with hardware at least once. Note that we
@@ -55,52 +55,52 @@
// will be created in the cache, if it does not exist, when the cache is
// accessed below.
- if ( ( REG_ACCESS_NONE != getAccessLevel() ) &&
- ( REG_ACCESS_WO != getAccessLevel() ) )
+ if ((REG_ACCESS_NONE != getAccessLevel()) &&
+ (REG_ACCESS_WO != getAccessLevel()))
{
- read( i_chip );
+ read(i_chip);
}
- return accessCache( i_chip );
+ return accessCache(i_chip);
}
//------------------------------------------------------------------------------
-ReturnCode HardwareRegister::read( const Chip & i_chip, bool i_force ) const
+ReturnCode HardwareRegister::read(const Chip & i_chip, bool i_force) const
{
ReturnCode rc;
// Verify this register belongs on i_chip.
- verifyAccessorChip( i_chip );
+ verifyAccessorChip(i_chip);
// Read from hardware only if the read is forced or the entry for this
// instance does not exist in the cache.
- if ( i_force || !queryCache(i_chip) )
+ if (i_force || !queryCache(i_chip))
{
// This register must be readable.
- HEI_ASSERT( ( REG_ACCESS_NONE != getAccessLevel() ) &&
- ( REG_ACCESS_WO != getAccessLevel() ) );
+ HEI_ASSERT((REG_ACCESS_NONE != getAccessLevel()) &&
+ (REG_ACCESS_WO != getAccessLevel()));
// Get the buffer from the register cache.
- BitString & bs = accessCache( i_chip );
+ BitString & bs = accessCache(i_chip);
// Get the byte size of the buffer.
- size_t sz_buffer = BitString::getMinBytes( bs.getBitLen() );
+ size_t sz_buffer = BitString::getMinBytes(bs.getBitLen());
// Read this register from hardware.
- rc = registerRead( i_chip.getChip(), bs.getBufAddr(),
- sz_buffer, getRegisterType(), getAddress() );
- if ( RC_SUCCESS != rc )
+ rc = registerRead(i_chip.getChip(), bs.getBufAddr(), sz_buffer,
+ getRegisterType(), getAddress());
+ if (RC_SUCCESS != rc)
{
// The read failed and we can't trust what was put in the register
// cache. So remove this instance's entry from the cache.
- flush( i_chip );
+ flush(i_chip);
}
else
{
// Sanity check. The returned size of the data written to the buffer
// should match the register size.
- HEI_ASSERT( getSize() == sz_buffer );
+ HEI_ASSERT(getSize() == sz_buffer);
}
}
@@ -111,35 +111,35 @@
#ifndef __HEI_READ_ONLY
-ReturnCode HardwareRegister::write( const Chip & i_chip ) const
+ReturnCode HardwareRegister::write(const Chip & i_chip) const
{
ReturnCode rc;
// Verify this register belongs on i_chip.
- verifyAccessorChip( i_chip );
+ verifyAccessorChip(i_chip);
// This register must be writable.
- HEI_ASSERT( ( REG_ACCESS_NONE != getAccessLevel() ) &&
- ( REG_ACCESS_RO != getAccessLevel() ) );
+ HEI_ASSERT((REG_ACCESS_NONE != getAccessLevel()) &&
+ (REG_ACCESS_RO != getAccessLevel()));
// An entry for this register must exist in the cache.
- HEI_ASSERT( queryCache(i_chip) );
+ HEI_ASSERT(queryCache(i_chip));
// Get the buffer from the register cache.
- BitString & bs = accessCache( i_chip );
+ BitString & bs = accessCache(i_chip);
// Get the byte size of the buffer.
- size_t sz_buffer = BitString::getMinBytes( bs.getBitLen() );
+ size_t sz_buffer = BitString::getMinBytes(bs.getBitLen());
// Write to this register to hardware.
- rc = registerWrite( i_chip.getChip(), bs.getBufAddr(),
- sz_buffer, getRegisterType(), getAddress() );
+ rc = registerWrite(i_chip.getChip(), bs.getBufAddr(),
+ sz_buffer, getRegisterType(), getAddress());
- if ( RC_SUCCESS == rc )
+ if (RC_SUCCESS == rc)
{
// Sanity check. The returned size of the data written to the buffer
// should match the register size.
- HEI_ASSERT( getSize() == sz_buffer );
+ HEI_ASSERT(getSize() == sz_buffer);
}
return rc;
@@ -153,18 +153,18 @@
//------------------------------------------------------------------------------
-bool HardwareRegister::Cache::query( const Chip & i_chip,
- const HardwareRegister * i_hwReg ) const
+bool HardwareRegister::Cache::query(const Chip & i_chip,
+ const HardwareRegister * i_hwReg) const
{
// Does i_chip exist in the cache?
- auto chipPairItr = iv_cache.find( i_chip );
- if ( iv_cache.end() != chipPairItr )
+ auto chipPairItr = iv_cache.find(i_chip);
+ if (iv_cache.end() != chipPairItr)
{
auto & hwRegMap = chipPairItr->second; // for ease of use
// Does i_hwReg exist in the cache?
- auto hwRegPairItr = hwRegMap.find( i_hwReg );
- if ( hwRegMap.end() != hwRegPairItr )
+ auto hwRegPairItr = hwRegMap.find(i_hwReg);
+ if (hwRegMap.end() != hwRegPairItr)
{
return true;
}
@@ -175,11 +175,11 @@
//------------------------------------------------------------------------------
-BitString & HardwareRegister::Cache::access( const Chip & i_chip,
- const HardwareRegister * i_hwReg )
+BitString & HardwareRegister::Cache::access(const Chip & i_chip,
+ const HardwareRegister * i_hwReg)
{
// If the entry does not exist, create a new entry.
- if ( !query(i_chip, i_hwReg) )
+ if (!query(i_chip, i_hwReg))
{
BitString * bs = new BitStringBuffer { i_hwReg->getSize() * 8 };
iv_cache[i_chip][i_hwReg] = bs;
@@ -194,9 +194,9 @@
void HardwareRegister::Cache::flush()
{
// Delete all of the BitStrings.
- for ( auto & chipPair : iv_cache )
+ for (auto & chipPair : iv_cache)
{
- for ( auto & hwRegPair : chipPair.second )
+ for (auto & hwRegPair : chipPair.second)
{
delete hwRegPair.second;
}
@@ -211,18 +211,18 @@
//------------------------------------------------------------------------------
-void HardwareRegister::Cache::flush( const Chip & i_chip,
- const HardwareRegister * i_hwReg )
+void HardwareRegister::Cache::flush(const Chip & i_chip,
+ const HardwareRegister * i_hwReg)
{
// Does i_chip exist in the cache?
- auto chipPairItr = iv_cache.find( i_chip );
- if ( iv_cache.end() != chipPairItr )
+ auto chipPairItr = iv_cache.find(i_chip);
+ if (iv_cache.end() != chipPairItr)
{
auto & hwRegMap = chipPairItr->second; // for ease of use
// Does i_hwReg exist in the cache?
- auto hwRegPairItr = hwRegMap.find( i_hwReg );
- if ( hwRegMap.end() != hwRegPairItr )
+ auto hwRegPairItr = hwRegMap.find(i_hwReg);
+ if (hwRegMap.end() != hwRegPairItr)
{
delete hwRegPairItr->second; // delete the BitString
hwRegMap.erase(i_hwReg); // remove the entry for this register
@@ -230,7 +230,7 @@
// If i_hwReg was the only entry for i_chip, we can remove i_chip from
// the cache.
- if ( hwRegMap.empty() )
+ if (hwRegMap.empty())
{
iv_cache.erase(i_chip);
}
@@ -240,4 +240,3 @@
//------------------------------------------------------------------------------
} // end namespace libhei
-