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