equals method

  1. @override
bool equals(
  1. ByteData e1,
  2. ByteData e2
)
override

Compare two elements for being equal.

This should be a proper equality relation.

Implementation

@override
bool equals(ByteData e1, ByteData e2) {
  if (e1.lengthInBytes != e2.lengthInBytes) {
    return false;
  }
  var i = 0;
  for (; i + 3 < e1.lengthInBytes; i += 4) {
    if (e1.getUint32(i) != e2.getUint32(i)) {
      return false;
    }
  }
  for (; i < e1.lengthInBytes; i++) {
    if (e1.getUint8(i) != e2.getUint8(i)) {
      return false;
    }
  }
  return true;
}