From a1b192723fadf150a1dba4f33574051c0ed3407d Mon Sep 17 00:00:00 2001 From: Toyam Cox Date: Tue, 6 Dec 2022 19:51:41 -0500 Subject: [PATCH] fix builds on 32bit systems @alixander says: This is the highest number we go to: ``` d2/lib/imgbundler/imgbundler.go Line 25 in 3f62eed const maxImageSize int64 = 1 << 25 // 33_554_432 ``` This is several shy of 64 bits, and even shy of 32 bits, so let's just choose 32 bits. --- d2layouts/d2sequence/sequence_diagram.go | 4 ++-- d2target/d2target.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/d2layouts/d2sequence/sequence_diagram.go b/d2layouts/d2sequence/sequence_diagram.go index 03abf99d6..7af45f227 100644 --- a/d2layouts/d2sequence/sequence_diagram.go +++ b/d2layouts/d2sequence/sequence_diagram.go @@ -43,7 +43,7 @@ type sequenceDiagram struct { } func getObjEarliestLineNum(o *d2graph.Object) int { - min := int(math.MaxInt64) + min := int(math.MaxInt32) for _, ref := range o.References { if ref.MapKey == nil { continue @@ -54,7 +54,7 @@ func getObjEarliestLineNum(o *d2graph.Object) int { } func getEdgeEarliestLineNum(e *d2graph.Edge) int { - min := int(math.MaxInt64) + min := int(math.MaxInt32) for _, ref := range e.References { if ref.MapKey == nil { continue diff --git a/d2target/d2target.go b/d2target/d2target.go index ded6812a1..41dc4c718 100644 --- a/d2target/d2target.go +++ b/d2target/d2target.go @@ -47,10 +47,10 @@ func (diagram Diagram) BoundingBox() (topLeft, bottomRight Point) { if len(diagram.Shapes) == 0 { return Point{0, 0}, Point{0, 0} } - x1 := int(math.MaxInt64) - y1 := int(math.MaxInt64) - x2 := int(-math.MaxInt64) - y2 := int(-math.MaxInt64) + x1 := int(math.MaxInt32) + y1 := int(math.MaxInt32) + x2 := int(math.MinInt32) + y2 := int(math.MinInt32) for _, targetShape := range diagram.Shapes { x1 = go2.Min(x1, targetShape.Pos.X)