package deprecatedimport ()// Int96 is an implementation of the deprecated INT96 parquet type.typeInt96 [3]uint32// Int32ToInt96 converts a int32 value to a Int96.func ( int32) ( Int96) {if < 0 { [2] = 0xFFFFFFFF [1] = 0xFFFFFFFF } [0] = uint32()return}// Int64ToInt96 converts a int64 value to Int96.func ( int64) ( Int96) {if < 0 { [2] = 0xFFFFFFFF } [1] = uint32( >> 32) [0] = uint32()return}// IsZero returns true if i is the zero-value.func ( Int96) () bool { return == Int96{} }// Negative returns true if i is a negative value.func ( Int96) () bool {return ([2] >> 31) != 0}// Less returns true if i < j.//// The method implements a signed comparison between the two operands.func ( Int96) ( Int96) bool {if .Negative() {if !.Negative() {returntrue } } else {if .Negative() {returnfalse } }for := 2; >= 0; -- { , := [], []switch {case < :returntruecase > :returnfalse } }returnfalse}// Int converts i to a big.Int representation.func ( Int96) () *big.Int { := new(big.Int) .Or(, big.NewInt(int64([2])<<32|int64([1]))) .Lsh(, 32) .Or(, big.NewInt(int64([0])))return}// Int32 converts i to a int32, potentially truncating the value.func ( Int96) () int32 {returnint32([0])}// Int64 converts i to a int64, potentially truncating the value.func ( Int96) () int64 {returnint64([1])<<32 | int64([0])}// String returns a string representation of i.func ( Int96) () string {return .Int().String()}// Len returns the minimum length in bits required to store the value of i.func ( Int96) () int {switch {case [2] != 0:return64 + bits.Len32([2])case [1] != 0:return32 + bits.Len32([1])default:returnbits.Len32([0]) }}func ( []Int96) int { := 0for := range { := [].Len()if > { = } }return}func ( []Int96) ( Int96) {iflen() > 0 { = [0]for , := range [1:] {if .Less() { = } } }return}func ( []Int96) ( Int96) {iflen() > 0 { = [0]for , := range [1:] {if .Less() { = } } }return}func ( []Int96) (, Int96) {iflen() > 0 { = [0] = [0]for , := range [1:] {if .Less() { = }if .Less() { = } } }return , }func ( []Int96) int {iflen() > 1 {ifint96AreInAscendingOrder() {return +1 }ifint96AreInDescendingOrder() {return -1 } }return0}func int96AreInAscendingOrder( []Int96) bool {for := len() - 1; > 0; -- {if [].Less([-1]) {returnfalse } }returntrue}func int96AreInDescendingOrder( []Int96) bool {for := len() - 1; > 0; -- {if [-1].Less([]) {returnfalse } }returntrue}
The pages are generated with Goldsv0.8.4. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.