toH0Bytes static method

List<int> toH0Bytes(
  1. int size
)

Convert the given size to 4 bytes, the high bit of each byte is 0

 sizeBytes[0] = ((size << 4) >>> 25) & 0x7F;
 sizeBytes[1] = ((size << 11) >>> 25) & 0x7F;
 sizeBytes[2] = ((size << 18) >>> 25) & 0x7F;
 sizeBytes[3] = ((size << 25) >>> 25) & 0x7F;

Implementation

static List<int> toH0Bytes(int size) {
  List<int> sizeBytes = List.filled(4, 0x00);
  sizeBytes[0] = ((size << 4) >>> 25) & 0x7F;
  sizeBytes[1] = ((size << 11) >>> 25) & 0x7F;
  sizeBytes[2] = ((size << 18) >>> 25) & 0x7F;
  sizeBytes[3] = ((size << 25) >>> 25) & 0x7F;
  return sizeBytes;
}