leftEncode static method

Uint8List leftEncode(
  1. int strLen
)

Implementation

static Uint8List leftEncode(int strLen) {
  var n = 1;
  var v = strLen;
  while ((v >>= 8) != 0) {
    n++;
  }
  var b = Uint8List(n + 1);
  b[0] = n;
  for (var i = 1; i <= n; i++) {
    b[i] = strLen >> (8 * (n - i));
  }
  return b;
}