static: Fix handling of heterogeneous macros

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2026-05-05 15:29:38 +02:00
parent 91ecaa6ad6
commit 272b1097d0
2 changed files with 13 additions and 4 deletions

View File

@ -653,6 +653,8 @@ class StaticPlacer
g.conc_density.reset(width, height, 0);
for (int idx = 0; idx < int(ccells.size()); idx++) {
auto &mc = mcells.at(idx);
if (mc.is_fixed)
continue;
auto &g = groups.at(mc.group);
auto loc = mc.pos;
auto size = mc.rect;
@ -1110,6 +1112,8 @@ class StaticPlacer
for (int c : macro.conc_cells) {
auto &cc = ccells.at(c);
auto &mc = mcells.at(c);
if (mc.is_fixed)
continue;
auto last_pos = mc.pos;
mc.pos = mc.pos * (1 - alpha) + (pos + RealPair(cc.chunk_dx, cc.chunk_dy)) * alpha;
mc.ref_pos = mc.ref_pos * (1 - alpha) + (ref_pos + RealPair(cc.chunk_dx, cc.chunk_dy)) * alpha;

View File

@ -35,8 +35,7 @@ enum class Axis
Y
};
template <typename T>
struct RealPairTempl
template <typename T> struct RealPairTempl
{
RealPairTempl() : x(0), y(0) {};
RealPairTempl(T x, T y) : x(x), y(y) {};
@ -62,8 +61,14 @@ struct RealPairTempl
inline T &at(Axis axis) { return (axis == Axis::Y) ? y : x; }
inline const T &at(Axis axis) const { return (axis == Axis::Y) ? y : x; }
};
template <typename T> inline RealPairTempl<T> operator+(RealPairTempl<T> a, RealPairTempl<T> b) { return RealPairTempl(a.x + b.x, a.y + b.y); }
template <typename T> inline RealPairTempl<T> operator-(RealPairTempl<T> a, RealPairTempl<T> b) { return RealPairTempl(a.x - b.x, a.y - b.y); }
template <typename T> inline RealPairTempl<T> operator+(RealPairTempl<T> a, RealPairTempl<T> b)
{
return RealPairTempl(a.x + b.x, a.y + b.y);
}
template <typename T> inline RealPairTempl<T> operator-(RealPairTempl<T> a, RealPairTempl<T> b)
{
return RealPairTempl(a.x - b.x, a.y - b.y);
}
using RealPair = RealPairTempl<float>;
using DoublePair = RealPairTempl<double>;