export function compare()

in modules/cache-material/src/portable_compare.ts [9:21]


export function compare(a: Uint8Array, b: Uint8Array) {
  const length = a.byteLength > b.byteLength ? b.byteLength : a.byteLength

  for (let i = 0; length > i; i += 1) {
    if (a[i] > b[i]) return 1
    if (a[i] < b[i]) return -1
  }

  if (a.byteLength > b.byteLength) return 1
  if (a.byteLength < b.byteLength) return -1

  return 0
}