github.com/annchain/OG@v0.0.9/og_interface/fix_length_bytes.go (about) 1 package og_interface 2 3 func BytesCmp(a FixLengthBytes, b FixLengthBytes) int { 4 if a.Length() != b.Length() { 5 return -1 6 } 7 8 ab := a.Bytes() 9 bb := b.Bytes() 10 11 for i := 0; i < a.Length(); i++ { 12 if ab[i] > bb[i] { 13 return 1 14 } else if ab[i] < bb[i] { 15 return -1 16 } 17 } 18 return 0 19 }