emkornfield commented on a change in pull request #10116:
URL: https://github.com/apache/arrow/pull/10116#discussion_r618528969



##########
File path: go/arrow/decimal128/decimal128.go
##########
@@ -54,6 +59,36 @@ func FromI64(v int64) Num {
        }
 }
 
+func fromBigIntPositive(v *big.Int) Num {
+       var buf [16]byte
+       // bigint will zero pad the bytes and write them as bigendian
+       // which we can then read out the high and low bytes to construct
+       // our 128bit value.
+       v.FillBytes(buf[:])
+       return Num{
+               lo: binary.BigEndian.Uint64(buf[8:]),
+               hi: int64(binary.BigEndian.Uint64(buf[:8])),
+       }
+}
+
+func FromBigInt(v *big.Int) Num {
+       if v.Sign() < 0 {
+               // if the value is negative, then get the high and low bytes 
from the

Review comment:
       sorry not sure I follow why the high/slow byte approach doesn't work for 
negative values?




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