zeroshade commented on code in PR #1130:
URL: https://github.com/apache/iceberg-go/pull/1130#discussion_r3305860006


##########
table/substrait/substrait.go:
##########
@@ -258,6 +260,15 @@ func toByteSliceSubstraitLiteral[T []byte | types.UUID](v 
T) expr.Literal {
        return expr.NewByteSliceLiteral(v, false)
 }
 
+// hostIsLittleEndian reports whether decimal128.Num's in-memory layout already
+// matches the Substrait 16-byte little-endian two's-complement encoding. True
+// on x86, arm64, and other LE architectures; false on s390x and other BE.
+var hostIsLittleEndian = func() bool {
+       var probe uint16 = 1
+
+       return *(*byte)(unsafe.Pointer(&probe)) == 1
+}()

Review Comment:
   why not just use a separate file and have `//go:build armbe || arm64be || 
m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || 
sparc || sparc64` with `const hostIsLE = false` and then a complementary file 
with `//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 
|| mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || 
sh || wasm` and `const hostIsLE = true`?



-- 
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]

Reply via email to