(hex: string)
| 117 | } |
| 118 | |
| 119 | function hexToI32(hex: string): i32 { |
| 120 | if (hex.startsWith('0x')) { |
| 121 | hex = hex.slice(2); |
| 122 | } |
| 123 | let unpadded = removeZeroPadding(hex); |
| 124 | return I32.parseInt(unpadded, 16); |
| 125 | } |
| 126 | |
| 127 | function removeZeroPadding(hex: string): string { |
| 128 | while (hex.startsWith('0')) { |
no test coverage detected