Open gromgull opened 3 months ago
if _int < 0: self.put_bool(1) s = 2 ** (bitsize - 1) self.put_arbitrary_uint(s - _int, bitsize - 1) else: self.put_bool(0) self.put_arbitrary_uint(_int, bitsize - 1)
The s - _int must be s + _int (since _int is negative)
s - _int
s + _int
otherwise you get a Exception: Not enough bits (1) to encode integer (3) error
Exception: Not enough bits (1) to encode integer (3)
Try:
from tvm_valuetypes.cell import Cell c = Cell() c.data.put_arbitrary_int(-1, 2)
The
s - _int
must bes + _int
(since _int is negative)otherwise you get a
Exception: Not enough bits (1) to encode integer (3)
errorTry: