Int64.fromBytesBigEndian constructor

Int64.fromBytesBigEndian(
  1. List<int> bytes
)

Implementation

factory Int64.fromBytesBigEndian(List<int> bytes) {
  var split1 = bytes[2] & 0xFF;
  var high =
      ((bytes[0] & 0xFF) << 12) | ((bytes[1] & 0xFF) << 4) | (split1 >> 4);
  var split2 = bytes[5] & 0xFF;
  var middle = (split1 << 18) |
      ((bytes[3] & 0xFF) << 10) |
      ((bytes[4] & 0xFF) << 2) |
      (split2 >> 6);
  var low = (split2 << 16) | ((bytes[6] & 0xFF) << 8) | (bytes[7] & 0xFF);
  // Top bits from above will be masked off here.
  return Int64._masked(low, middle, high);
}