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 += 8) {
    var n0 = list[i];
    var n1 = list[i + 1];
    var n2 = list[i + 2];
    var n3 = list[i + 3];

    var n4 = list[i + 4];
    var n5 = list[i + 5];
    var n6 = list[i + 6];
    var n7 = list[i + 7];

    list[i] = n7;
    list[i + 1] = n6;
    list[i + 2] = n5;
    list[i + 3] = n4;

    list[i + 4] = n3;
    list[i + 5] = n2;
    list[i + 6] = n1;
    list[i + 7] = n0;
  }

  return list;
}