| 33 | } |
| 34 | |
| 35 | uint32_t writeVarUint32(uint8_t *dst, uint32_t offset, int32_t value) { |
| 36 | if (value >> 7 == 0) { |
| 37 | dst[offset] = (uint8_t)value; |
| 38 | return 1; |
| 39 | } |
| 40 | if (value >> 14 == 0) { |
| 41 | dst[offset++] = (uint8_t)((value & 0x7F) | 0x80); |
| 42 | dst[offset++] = (uint8_t)(value >> 7); |
| 43 | return 2; |
| 44 | } |
| 45 | if (value >> 21 == 0) { |
| 46 | dst[offset++] = (uint8_t)((value & 0x7F) | 0x80); |
| 47 | dst[offset++] = (uint8_t)(value >> 7 | 0x80); |
| 48 | dst[offset++] = (uint8_t)(value >> 14); |
| 49 | return 3; |
| 50 | } |
| 51 | if (value >> 28 == 0) { |
| 52 | dst[offset++] = (uint8_t)((value & 0x7F) | 0x80); |
| 53 | dst[offset++] = (uint8_t)(value >> 7 | 0x80); |
| 54 | dst[offset++] = (uint8_t)(value >> 14 | 0x80); |
| 55 | dst[offset++] = (uint8_t)(value >> 21); |
| 56 | return 4; |
| 57 | } |
| 58 | dst[offset++] = (uint8_t)((value & 0x7F) | 0x80); |
| 59 | dst[offset++] = (uint8_t)(value >> 7 | 0x80); |
| 60 | dst[offset++] = (uint8_t)(value >> 14 | 0x80); |
| 61 | dst[offset++] = (uint8_t)(value >> 21 | 0x80); |
| 62 | dst[offset++] = (uint8_t)(value >> 28); |
| 63 | return 5; |
| 64 | } |
| 65 | |
| 66 | enum Encoding { LATIN1, UTF16, UTF8 }; |
| 67 |
no outgoing calls
no test coverage detected