(f)
| 444 | |
| 445 | |
| 446 | def read_varuint(f) -> int: |
| 447 | res = 0 |
| 448 | shift = 0 |
| 449 | more = True |
| 450 | while more: |
| 451 | b = f.read(1) |
| 452 | if not b: |
| 453 | return res |
| 454 | try: |
| 455 | bc = ord(b) |
| 456 | except TypeError: |
| 457 | bc = b |
| 458 | res |= (bc & 0x7F) << shift |
| 459 | shift += 7 |
| 460 | more = bc >= 0x80 |
| 461 | return res |
| 462 | |
| 463 | |
| 464 | def zigzag_decode(uint: int) -> int: |
no test coverage detected