chaokunyang commented on code in PR #3313:
URL: https://github.com/apache/fory/pull/3313#discussion_r2786168426
##########
go/fory/slice_primitive_test.go:
##########
@@ -65,3 +67,351 @@ func TestFloat16Slice(t *testing.T) {
assert.Nil(t, result)
})
}
+
+func TestIntSlice(t *testing.T) {
+ f := NewFory()
+
+ t.Run("int_slice_large_numbers", func(t *testing.T) {
+ slice := []int{1, -2, 3, -4, 2147483647, -2147483648} //
Example with large int32 values
+ if strconv.IntSize == 64 {
+ slice = []int{1, -2, 3, -4, math.MaxInt64,
math.MinInt64} // For int64
Review Comment:
Using `math.MaxInt64`/`math.MinInt64` in a `[]int` literal and
`math.MaxUint64` in a `[]uint` literal still overflows at compile time on
32-bit targets (for example `GOARCH=386`), even with the `IntSize` runtime
guard. Please switch these literals to arch-sized bounds (`math.MaxInt`,
`math.MinInt`, `math.MaxUint`) or build the 64-bit cases without overflowing
constants.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]