calH0Size static method

int calH0Size(
  1. List<int> bytes
)

Given 4 bytes, the high bit of each byte is 0, calculate its size

  • bytes: bytes which length is 4
final size = (bytes[3] & 0x7F) +
     ((bytes[2] & 0x7F) << 7) +
     ((bytes[1] & 0x7F) << 14) +
     ((bytes[0] & 0x7F) << 21);

Implementation

static int calH0Size(List<int> bytes) {
  assert(bytes.length == 4);
  final size = (bytes[3] & 0x7F) +
      ((bytes[2] & 0x7F) << 7) +
      ((bytes[1] & 0x7F) << 14) +
      ((bytes[0] & 0x7F) << 21);
  return size;
}