mundaym commented on a change in pull request #8011:
URL: https://github.com/apache/arrow/pull/8011#discussion_r487033507



##########
File path: go/arrow/type_traits_decimal128.go
##########
@@ -39,8 +40,13 @@ func (decimal128Traits) BytesRequired(n int) int { return 
Decimal128SizeBytes *
 
 // PutValue
 func (decimal128Traits) PutValue(b []byte, v decimal128.Num) {
-       binary.LittleEndian.PutUint64(b[:8], uint64(v.LowBits()))
-       binary.LittleEndian.PutUint64(b[8:], uint64(v.HighBits()))
+       if runtime.GOARCH == "s390x" {

Review comment:
       A simple 'endian' (or another name) package containing some files like 
this might help reduce the if statement spam, and address @emkornfield's 
concerns (though the compiler is pretty good at removing those branches):
   
   big.go:
   ```go
   // +build s390x
   
   package endian
   import "encoding/binary"
   var Native = binary.BigEndian
   ```
   little.go:
   ```go
   // +build !s390x
   
   package endian
   import "encoding/binary"
   var Native = binary.LittleEndian
   ```
   
   Then you can just use `endian.Native.*` functions instead of having if 
statements. Plus support for other big endian platforms becomes easy.
   
   (Note that even though Native is a variable the methods called on it will 
still be resolved at compile time because the type is constant).




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to