int deserializeUleb128AsUint32()

in serde-generate/runtime/dart/bcs/bcs_deserializer.dart [9:26]


  int deserializeUleb128AsUint32() {
    var value = 0;
    for (var shift = 0; shift < 32; shift += 7) {
      final x = super.deserializeUint8();
      final digit = (x & 0x7F);
      value = value | (digit << shift);
      if (value > maxInt) {
        throw Exception('Overflow while parsing uleb128-encoded uint32 value');
      }
      if (digit == x) {
        if (shift > 0 && digit == 0) {
          throw Exception('Invalid uleb128 number (unexpected zero digit)');
        }
        return value;
      }
    }
    throw Exception('Overflow while parsing uleb128-encoded uint32 value');
  }