The Road to Clang-Format part 4
The Return of the Endline
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I5c0e8a8639ae9433c9a5f5eed444c07763e5bc3f
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index b863829..39a585c 100755
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -101,8 +101,12 @@
// Get the bit fields on either side of the target bit field.
uint64_t bf_l_shift = UINT8_BIT_LEN - bf_l_len;
uint64_t bf_r_shift = UINT8_BIT_LEN - bf_r_len;
- uint8_t bf_l = *relAddr; bf_l >>= bf_l_shift; bf_l <<= bf_l_shift;
- uint8_t bf_r = *relAddr; bf_r <<= bf_r_shift; bf_r >>= bf_r_shift;
+ uint8_t bf_l = *relAddr;
+ bf_l >>= bf_l_shift;
+ bf_l <<= bf_l_shift;
+ uint8_t bf_r = *relAddr;
+ bf_r <<= bf_r_shift;
+ bf_r >>= bf_r_shift;
// Combine all three parts of the byte and write it out to memory.
*relAddr = bf_l | bf | bf_r;
@@ -269,7 +273,8 @@
for (uint64_t i = i_pos; i < endPos; i++)
{
- if (isBitSet(i)) count++;
+ if (isBitSet(i))
+ count++;
}
return count;
@@ -410,7 +415,10 @@
BitString(i_bs.getBitLen(), nullptr)
{
initBuffer();
- if (!i_bs.isZero()) setString(i_bs);
+ if (!i_bs.isZero())
+ {
+ setString(i_bs);
+ }
}
//------------------------------------------------------------------------------
@@ -419,7 +427,10 @@
BitString(i_bsb.getBitLen(), nullptr)
{
initBuffer();
- if (!i_bsb.isZero()) setString(i_bsb);
+ if (!i_bsb.isZero())
+ {
+ setString(i_bsb);
+ }
}
//------------------------------------------------------------------------------
@@ -433,7 +444,10 @@
setBitLen(i_bs.getBitLen());
initBuffer();
- if (!i_bs.isZero()) setString(i_bs);
+ if (!i_bs.isZero())
+ {
+ setString(i_bs);
+ }
return *this;
}
@@ -451,7 +465,10 @@
setBitLen(i_bsb.getBitLen());
initBuffer();
- if (!i_bsb.isZero()) setString(i_bsb);
+ if (!i_bsb.isZero())
+ {
+ setString(i_bsb);
+ }
}
return *this;
diff --git a/src/util/hei_bit_string.hpp b/src/util/hei_bit_string.hpp
index a227ffc..6229441 100755
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -84,11 +84,17 @@
virtual ~BitString() {}
/** @return The number of bits in the bit string buffer. */
- uint64_t getBitLen() const { return iv_bitLen; }
+ uint64_t getBitLen() const
+ {
+ return iv_bitLen;
+ }
/** @return The address of the bit string buffer. Note that this may
* return nullptr. */
- void* getBufAddr() const { return iv_bufAddr; }
+ void* getBufAddr() const
+ {
+ return iv_bufAddr;
+ }
/**
* @param i_bitLen The number of bits for a bit string.
@@ -175,20 +181,32 @@
* @param i_pos The target position.
* @pre i_pos < getBitLen().
*/
- void setBit(uint64_t i_pos) { setFieldRight(i_pos, 1, 1); }
+ void setBit(uint64_t i_pos)
+ {
+ setFieldRight(i_pos, 1, 1);
+ }
/** @brief Sets the entire bit string to 1's. */
- void setAll() { setPattern(UINT64_MAX); }
+ void setAll()
+ {
+ setPattern(UINT64_MAX);
+ }
/**
* @brief Sets the target position to 0.
* @param i_pos The target position.
* @pre i_pos < getBitLen().
*/
- void clearBit(uint64_t i_pos) { setFieldRight(i_pos, 1, 0); }
+ void clearBit(uint64_t i_pos)
+ {
+ setFieldRight(i_pos, 1, 0);
+ }
/** @brief Sets the entire bit string to 0's. */
- void clearAll() { setPattern(0); }
+ void clearAll()
+ {
+ setPattern(0);
+ }
/**
* @brief Sets a range within the string based on the pattern and length
@@ -306,10 +324,16 @@
uint64_t getSetCount(uint64_t i_pos, uint64_t i_len) const;
/** @return The number of bits that are set(1) in this string. */
- uint64_t getSetCount() const { return getSetCount(0, getBitLen()); }
+ uint64_t getSetCount() const
+ {
+ return getSetCount(0, getBitLen());
+ }
/** @brief Comparison operator. */
- bool operator==(const BitString& i_str) const { return isEqual(i_str); }
+ bool operator==(const BitString& i_str) const
+ {
+ return isEqual(i_str);
+ }
/** @brief Bitwise NOT operator. */
BitStringBuffer operator~() const;
@@ -357,10 +381,16 @@
* @pre Before calling this function, make sure you deallocate the old
* buffer to avoid memory leaks.
*/
- void setBufAddr(void* i_newBufAddr) { iv_bufAddr = i_newBufAddr; }
+ void setBufAddr(void* i_newBufAddr)
+ {
+ iv_bufAddr = i_newBufAddr;
+ }
/** @param i_newBitLen The new bit length of this bit string buffer. */
- void setBitLen(uint64_t i_newBitLen) { iv_bitLen = i_newBitLen; }
+ void setBitLen(uint64_t i_newBitLen)
+ {
+ iv_bitLen = i_newBitLen;
+ }
private: // functions
@@ -374,8 +404,7 @@
* @pre nullptr != getBufAddr()
* @pre i_absPos < getBitLen()
*/
- uint8_t* getRelativePosition(uint64_t& o_relPos,
- uint64_t i_absPos) const;
+ uint8_t* getRelativePosition(uint64_t& o_relPos, uint64_t i_absPos) const;
private: // instance variables
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index d6ce023..4aeb952 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -18,7 +18,10 @@
Flyweight() = default;
/** @brief Destructor. */
- ~Flyweight() { clear(); }
+ ~Flyweight()
+ {
+ clear();
+ }
/** @brief Default copy constructor. */
Flyweight(const Flyweight&) = delete;
@@ -69,7 +72,10 @@
*/
void clear()
{
- for (auto i : iv_index) { delete i; }
+ for (auto i : iv_index)
+ {
+ delete i;
+ }
iv_index.clear();
}
@@ -83,7 +89,10 @@
* initialization. Afterwards, the extra capacity is not needed. So this
* function will shrink the capacity to the size of the vector.
*/
- void compact() { iv_index.shrink_to_fit(); }
+ void compact()
+ {
+ iv_index.shrink_to_fit();
+ }
private: