github.com/primecitizens/pcz/std@v0.2.1/core/cmp/bs.notpcz.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  //go:build !pcz
     5  
     6  package cmp
     7  
     8  import (
     9  	"bytes"
    10  	"unsafe"
    11  )
    12  
    13  func Bytes(a, b []byte) int {
    14  	return bytes.Compare(a, b)
    15  }
    16  
    17  func String(a, b string) int {
    18  	return bytes.Compare(
    19  		unsafe.Slice(unsafe.StringData(a), len(a)),
    20  		unsafe.Slice(unsafe.StringData(b), len(b)),
    21  	)
    22  }