(writer, _value)
| 22 | return 0; |
| 23 | } |
| 24 | encode(writer, _value) { |
| 25 | let value = (0, index_js_1.getBigInt)(typed_js_1.Typed.dereference(_value, this.type)); |
| 26 | // Check bounds are safe for encoding |
| 27 | let maxUintValue = (0, index_js_1.mask)(BN_MAX_UINT256, abstract_coder_js_1.WordSize * 8); |
| 28 | if (this.signed) { |
| 29 | let bounds = (0, index_js_1.mask)(maxUintValue, (this.size * 8) - 1); |
| 30 | if (value > bounds || value < -(bounds + BN_1)) { |
| 31 | this._throwError("value out-of-bounds", _value); |
| 32 | } |
| 33 | value = (0, index_js_1.toTwos)(value, 8 * abstract_coder_js_1.WordSize); |
| 34 | } |
| 35 | else if (value < BN_0 || value > (0, index_js_1.mask)(maxUintValue, this.size * 8)) { |
| 36 | this._throwError("value out-of-bounds", _value); |
| 37 | } |
| 38 | return writer.writeValue(value); |
| 39 | } |
| 40 | decode(reader) { |
| 41 | let value = (0, index_js_1.mask)(reader.readValue(), this.size * 8); |
| 42 | if (this.signed) { |
nothing calls this directly
no test coverage detected