From d827454ec41d231f144497834b004c013c987f54 Mon Sep 17 00:00:00 2001 From: Matt Liberty Date: Sat, 23 Nov 2024 16:00:24 +0000 Subject: [PATCH] odb & pad: used std int64_t instead of int64 (likewise uint64) Signed-off-by: Matt Liberty --- src/odb/include/odb/db.h | 2 +- src/odb/include/odb/dbTypes.h | 8 ++++---- src/odb/include/odb/geom.h | 30 +++++++++++++++--------------- src/odb/include/odb/odb.h | 3 --- src/odb/src/db/dbWire.cpp | 4 ++-- src/pad/include/pad/ICeWall.h | 14 +++++++------- src/pad/src/ICeWall.cpp | 20 ++++++++++---------- 7 files changed, 39 insertions(+), 42 deletions(-) diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index b2f971820f7..7dae667d649 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -3912,7 +3912,7 @@ class dbWire : public dbObject /// /// Get the total path length contained in this wire. /// - uint64 getLength(); + uint64_t getLength(); /// /// Get the number of entries contained in this wire. diff --git a/src/odb/include/odb/dbTypes.h b/src/odb/include/odb/dbTypes.h index aedb9a31ac0..08179624bdf 100644 --- a/src/odb/include/odb/dbTypes.h +++ b/src/odb/include/odb/dbTypes.h @@ -1279,13 +1279,13 @@ class dbSourceType Value _value; }; -constexpr uint64 MAX_UINT64 = 0xffffffffffffffffLL; -constexpr uint64 MIN_UINT64 = 0; +constexpr uint64_t MAX_UINT64 = 0xffffffffffffffffLL; +constexpr uint64_t MIN_UINT64 = 0; constexpr uint MAX_UINT = 0xffffffff; constexpr uint MIN_UINT = 0; -constexpr int64 MAX_INT64 = 0x7fffffffffffffffLL; -constexpr int64 MIN_INT64 = 0x8000000000000000LL; +constexpr int64_t MAX_INT64 = 0x7fffffffffffffffLL; +constexpr int64_t MIN_INT64 = 0x8000000000000000LL; constexpr int MAX_INT = 0x7fffffff; constexpr int MIN_INT = 0x80000000; diff --git a/src/odb/include/odb/geom.h b/src/odb/include/odb/geom.h index 65dcabb4700..67ec89f250d 100644 --- a/src/odb/include/odb/geom.h +++ b/src/odb/include/odb/geom.h @@ -77,10 +77,10 @@ class Point int y() const { return y_; } // compute the square distance between two points - static int64 squaredDistance(Point p0, Point p1); + static int64_t squaredDistance(Point p0, Point p1); // compute the manhattan distance between two points - static int64 manhattanDistance(Point p0, Point p1); + static int64_t manhattanDistance(Point p0, Point p1); friend dbIStream& operator>>(dbIStream& stream, Point& p); friend dbOStream& operator<<(dbOStream& stream, const Point& p); @@ -304,8 +304,8 @@ class Rect // Compute the intersection of these two rectangles. Rect intersect(const Rect& r) const; - int64 area() const; - int64 margin() const; + int64_t area() const; + int64_t margin() const; void printf(FILE* fp, const char* prefix = ""); void print(const char* prefix = ""); @@ -431,17 +431,17 @@ inline void Point::rotate270() y_ = yp; } -inline int64 Point::squaredDistance(Point p0, Point p1) +inline int64_t Point::squaredDistance(Point p0, Point p1) { - const int64 dx = p1.x_ - p0.x_; - const int64 dy = p1.y_ - p0.y_; + const int64_t dx = p1.x_ - p0.x_; + const int64_t dy = p1.y_ - p0.y_; return dx * dx + dy * dy; } -inline int64 Point::manhattanDistance(Point p0, Point p1) +inline int64_t Point::manhattanDistance(Point p0, Point p1) { - const int64 dx = std::abs(p1.x_ - p0.x_); - const int64 dy = std::abs(p1.y_ - p0.y_); + const int64_t dx = std::abs(p1.x_ - p0.x_); + const int64_t dy = std::abs(p1.y_ - p0.y_); return dx + dy; } @@ -730,15 +730,15 @@ inline Rect Rect::intersect(const Rect& r) const return result; } -inline int64 Rect::area() const +inline int64_t Rect::area() const { - return dx() * static_cast(dy()); + return dx() * static_cast(dy()); } -inline int64 Rect::margin() const +inline int64_t Rect::margin() const { - const int64 DX = dx(); - const int64 DY = dy(); + const int64_t DX = dx(); + const int64_t DY = dy(); return DX + DX + DY + DY; } diff --git a/src/odb/include/odb/odb.h b/src/odb/include/odb/odb.h index 3e0683bf0cf..ebf4435fe15 100644 --- a/src/odb/include/odb/odb.h +++ b/src/odb/include/odb/odb.h @@ -47,9 +47,6 @@ namespace odb { using uint = unsigned int; using uchar = unsigned char; -using int64 = std::int64_t; -using uint64 = std::uint64_t; - #ifndef SWIG using utl::format_as; #endif diff --git a/src/odb/src/db/dbWire.cpp b/src/odb/src/db/dbWire.cpp index 469023c90c2..8fe8c254cf8 100644 --- a/src/odb/src/db/dbWire.cpp +++ b/src/odb/src/db/dbWire.cpp @@ -962,11 +962,11 @@ void dbWire::printWire(FILE* fp, int fid, int tid) } } -uint64 dbWire::getLength() +uint64_t dbWire::getLength() { dbWireShapeItr shapes; dbShape s; - uint64 rtlen = 0; + uint64_t rtlen = 0; for (shapes.begin(this); shapes.next(s);) { if (!s.isVia()) { rtlen += s.getLength(); diff --git a/src/pad/include/pad/ICeWall.h b/src/pad/include/pad/ICeWall.h index f66326f45f5..5993a6f7ca2 100644 --- a/src/pad/include/pad/ICeWall.h +++ b/src/pad/include/pad/ICeWall.h @@ -159,13 +159,13 @@ class ICeWall std::string getRowName(const std::string& name, int ring_index) const; odb::Direction2D::Value getRowEdge(odb::dbRow* row) const; - odb::int64 estimateWirelengths(odb::dbInst* inst, - const std::set& iterms) const; - odb::int64 computePadBumpDistance(odb::dbInst* inst, - int inst_width, - odb::dbITerm* bump, - odb::dbRow* row, - int center_pos) const; + int64_t estimateWirelengths(odb::dbInst* inst, + const std::set& iterms) const; + int64_t computePadBumpDistance(odb::dbInst* inst, + int inst_width, + odb::dbITerm* bump, + odb::dbRow* row, + int center_pos) const; void placePadsUniform(const std::vector& insts, odb::dbRow* row, const std::map& inst_widths, diff --git a/src/pad/src/ICeWall.cpp b/src/pad/src/ICeWall.cpp index 7141ece7782..630d2b03242 100644 --- a/src/pad/src/ICeWall.cpp +++ b/src/pad/src/ICeWall.cpp @@ -592,7 +592,7 @@ void ICeWall::placePad(odb::dbMaster* master, placeInstance(row, snapToRowSite(row, location), inst, orient.getOrient()); } -odb::int64 ICeWall::estimateWirelengths( +int64_t ICeWall::estimateWirelengths( odb::dbInst* inst, const std::set& iterms) const { @@ -605,7 +605,7 @@ odb::int64 ICeWall::estimateWirelengths( } } - odb::int64 dist = 0; + int64_t dist = 0; for (const auto& [term0, term1] : terms) { dist += odb::Point::manhattanDistance(term0->getBBox().center(), @@ -615,11 +615,11 @@ odb::int64 ICeWall::estimateWirelengths( return dist; } -odb::int64 ICeWall::computePadBumpDistance(odb::dbInst* inst, - int inst_width, - odb::dbITerm* bump, - odb::dbRow* row, - int center_pos) const +int64_t ICeWall::computePadBumpDistance(odb::dbInst* inst, + int inst_width, + odb::dbITerm* bump, + odb::dbRow* row, + int center_pos) const { const odb::Point row_center = row->getBBox().center(); const odb::Point center = bump->getBBox().center(); @@ -635,7 +635,7 @@ odb::int64 ICeWall::computePadBumpDistance(odb::dbInst* inst, odb::Point(row_center.x(), center_pos + inst_width / 2), center); } - return std::numeric_limits::max(); + return std::numeric_limits::max(); } void ICeWall::placePads(const std::vector& insts, odb::dbRow* row) @@ -822,7 +822,7 @@ void ICeWall::performPadFlip( const auto& pins = find_assignment->second; if (pins.size() > 1) { // only need to check if pad has more than one connection - const odb::int64 start_wirelength = estimateWirelengths(inst, pins); + const int64_t start_wirelength = estimateWirelengths(inst, pins); const auto start_orient = inst->getOrient(); // try flipping pad @@ -839,7 +839,7 @@ void ICeWall::performPadFlip( } // get new wirelength - const odb::int64 flipped_wirelength = estimateWirelengths(inst, pins); + const int64_t flipped_wirelength = estimateWirelengths(inst, pins); const bool undo = flipped_wirelength > start_wirelength; if (undo) {