From 23f2fff1c83eed5b80421c485cf887cf2d232f73 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 22 Mar 2019 10:39:05 +0000 Subject: [PATCH] clangformat Signed-off-by: David Shah --- common/placer1.cc | 2 +- common/timing.cc | 5 ++--- ecp5/arch.h | 27 +++++++++++++++------------ gui/fpgaviewwidget.cc | 10 +++++----- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/common/placer1.cc b/common/placer1.cc index 9ebf3ee6..0c918f33 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -318,7 +318,7 @@ class SAPlacer "%.0f, wirelen = %.0f, dia = %d, Ra = %.02f \n", iter, temp, double(curr_timing_cost), double(curr_wirelen_cost), diameter, Raccept); - if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) { + if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) { avg_wirelen = 0.8 * avg_wirelen + 0.2 * curr_wirelen_cost; } else { double diam_next = diameter * (1.0 - 0.44 + Raccept); diff --git a/common/timing.cc b/common/timing.cc index 2a0af874..2ce9eea3 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -904,10 +904,9 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_fmax, bool p if (!warn_on_failure || passed) log_info("Max frequency for clock %*s'%s': %.02f MHz (%s at %.02f MHz)\n", width, "", clock_name.c_str(), clock_fmax[clock.first], passed ? "PASS" : "FAIL", target); - else - if (bool_or_default(ctx->settings, ctx->id("timing/allowFail"), false)) + else if (bool_or_default(ctx->settings, ctx->id("timing/allowFail"), false)) log_warning("Max frequency for clock %*s'%s': %.02f MHz (%s at %.02f MHz)\n", width, "", - clock_name.c_str(), clock_fmax[clock.first], passed ? "PASS" : "FAIL", target); + clock_name.c_str(), clock_fmax[clock.first], passed ? "PASS" : "FAIL", target); else log_nonfatal_error("Max frequency for clock %*s'%s': %.02f MHz (%s at %.02f MHz)\n", width, "", clock_name.c_str(), clock_fmax[clock.first], passed ? "PASS" : "FAIL", target); diff --git a/ecp5/arch.h b/ecp5/arch.h index b19e008f..2e86988a 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -448,25 +448,28 @@ struct ArchArgs } speed = SPEED_6; }; -struct DelayKey { +struct DelayKey +{ IdString celltype, from, to; - inline bool operator==(const DelayKey &other) const { + inline bool operator==(const DelayKey &other) const + { return celltype == other.celltype && from == other.from && to == other.to; } }; NEXTPNR_NAMESPACE_END namespace std { - template<> - struct hash { - std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX DelayKey &dk) const noexcept { - std::size_t seed = std::hash()(dk.celltype); - seed ^= std::hash()(dk.from) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= std::hash()(dk.to) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - return seed; - } - }; -} +template <> struct hash +{ + std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX DelayKey &dk) const noexcept + { + std::size_t seed = std::hash()(dk.celltype); + seed ^= std::hash()(dk.from) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= std::hash()(dk.to) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + return seed; + } +}; +} // namespace std NEXTPNR_NAMESPACE_BEGIN struct Arch : BaseCtx diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index c932c3e7..5eab20ed 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -645,10 +645,10 @@ void FPGAViewWidget::mousePressEvent(QMouseEvent *event) return; bool shift = QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier); - bool ctrl = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier); + bool ctrl = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier); bool btn_right = event->buttons() & Qt::RightButton; - bool btn_mid = event->buttons() & Qt::MidButton; - bool btn_left = event->buttons() & Qt::LeftButton; + bool btn_mid = event->buttons() & Qt::MidButton; + bool btn_left = event->buttons() & Qt::LeftButton; if (btn_right || btn_mid || (btn_left && shift)) { lastDragPos_ = event->pos(); @@ -687,8 +687,8 @@ void FPGAViewWidget::mouseMoveEvent(QMouseEvent *event) bool shift = QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier); bool btn_right = event->buttons() & Qt::RightButton; - bool btn_mid = event->buttons() & Qt::MidButton; - bool btn_left = event->buttons() & Qt::LeftButton; + bool btn_mid = event->buttons() & Qt::MidButton; + bool btn_left = event->buttons() & Qt::LeftButton; if (btn_right || btn_mid || (btn_left && shift)) { const int dx = event->x() - lastDragPos_.x();