convertToUint8ListReversedEndian method

Uint8List convertToUint8ListReversedEndian()

Converts this instance to an Uint8List with elements in reversed endianness.

Implementation

Uint8List convertToUint8ListReversedEndian() {
  var list = convertToUint8ListHostEndian();

  var length = list.length;
  for (var i = 0; i < length; i += 4) {
    var n0 = list[i];
    var n1 = list[i + 1];
    var n2 = list[i + 2];
    var n3 = list[i + 3];

    list[i] = n3;
    list[i + 1] = n2;
    list[i + 2] = n1;
    list[i + 3] = n0;
  }

  return list;
}