aboutsummaryrefslogtreecommitdiffstats
path: root/common/bits.cc
diff options
context:
space:
mode:
authorKeith Rothman <537074+litghost@users.noreply.github.com>2021-02-23 13:55:05 -0800
committerKeith Rothman <537074+litghost@users.noreply.github.com>2021-02-23 13:55:05 -0800
commitbf458cbc5a71980a9500206723386ad5488dfe80 (patch)
treedcf3cc6034f4101f52b51eed1f586c8eb86175e0 /common/bits.cc
parent20f0ba9526abfb8c39fa16099f0eefd2c0555eac (diff)
downloadnextpnr-bf458cbc5a71980a9500206723386ad5488dfe80.tar.gz
nextpnr-bf458cbc5a71980a9500206723386ad5488dfe80.tar.bz2
nextpnr-bf458cbc5a71980a9500206723386ad5488dfe80.zip
Run "make clangformat" to fix new Bits library.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'common/bits.cc')
-rw-r--r--common/bits.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/common/bits.cc b/common/bits.cc
index 1fe65544..36c7539a 100644
--- a/common/bits.cc
+++ b/common/bits.cc
@@ -24,7 +24,8 @@
namespace nextpnr {
-int Bits::generic_popcount(unsigned int v) {
+int Bits::generic_popcount(unsigned int v)
+{
unsigned int c; // c accumulates the total bits set in v
for (c = 0; v; c++) {
v &= v - 1; // clear the least significant bit set
@@ -33,13 +34,14 @@ int Bits::generic_popcount(unsigned int v) {
return c;
}
-int Bits::generic_ctz(unsigned int x) {
- if(x == 0) {
+int Bits::generic_ctz(unsigned int x)
+{
+ if (x == 0) {
throw std::runtime_error("Cannot call ctz with arg = 0");
}
- for(size_t i = 0; i < std::numeric_limits<unsigned int>::digits; ++i) {
- if((x & (1 << i)) != 0) {
+ for (size_t i = 0; i < std::numeric_limits<unsigned int>::digits; ++i) {
+ if ((x & (1 << i)) != 0) {
return i;
}
}
@@ -48,4 +50,4 @@ int Bits::generic_ctz(unsigned int x) {
throw std::runtime_error("Unreachable!");
}
-};
+}; // namespace nextpnr