toH1Bytes static method

List<int> toH1Bytes(
  1. int size
)

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

 sizeBytes[0] = (size >>> 24) & 0xFF;
 sizeBytes[1] = ((size << 8) >>> 24) & 0xFF;
 sizeBytes[2] = ((size << 16) >>> 24) & 0xFF;
 sizeBytes[3] = ((size << 24) >>> 24) & 0xFF;

Implementation

static List<int> toH1Bytes(int size) {
  List<int> sizeBytes = List.filled(4, 0x00);
  sizeBytes[0] = (size >>> 24) & 0xFF;
  sizeBytes[1] = ((size << 8) >>> 24) & 0xFF;
  sizeBytes[2] = ((size << 16) >>> 24) & 0xFF;
  sizeBytes[3] = ((size << 24) >>> 24) & 0xFF;
  return sizeBytes;
}