graph/encoding/{digraph6,graph6}: allow packages to build on 32-bit arches
MODIFY
graph/encoding/digraph6/digraph6.go
graph/encoding/digraph6/digraph6.go
@@ -57,7 +57,12 @@ func Encode(g graph.Graph) Graph {
var buf strings.Builder
buf.WriteByte('&')
- switch {
+ // digraph6 specifies graphs of order up to 2^36-1 which
+ // overflows int on 32-bit architectures. We know that on
+ // those machines n will not be this large, since it came
+ // from a length, but explicitly convert to 64 bits to
+ // allow the package to build on those architectures.
+ switch n := int64(n); {
case n < 63:
buf.WriteByte(byte(n) + 63)
case n < 258048:

MODIFY
graph/encoding/graph6/graph6.go
graph/encoding/graph6/graph6.go
@@ -58,7 +58,12 @@ func Encode(g graph.Graph) Graph {
}
var buf strings.Builder
- switch {
+ // graph6 specifies graphs of order up to 2^36-1 which
+ // overflows int on 32-bit architectures. We know that on
+ // those machines n will not be this large, since it came
+ // from a length, but explicitly convert to 64 bits to
+ // allow the package to build on those architectures.
+ switch n := int64(n); {
case n < 63:
buf.WriteByte(byte(n) + 63)
case n < 258048:

graph/encoding/{digraph6,graph6}: allow packages to build on 32-bit arches