I want to store -1
in smallest memory such as in {8||16||32} bits instead of 256 bits.
int i = -1;
When I return var
, it returns
-1L
instead of -1
.
I have assigned -1
into a int8
variable. As I know int8
is signed integer.
int8 i = -1;
But when I return output
, it returns: '115792089237316195423570985008687907853269984665640564039457584007913129639679L' instead of -1
.
[Q] What should I do to obtain -1
?
Please note that I have experimented this problem in populus
:
As contract I have use @RichardHorrocks's contract: NumTest
on the answer.
test.py:
def test_receipt(web3, accounts, chain, unmigrated_chain):
my_contract = unmigrated_chain.get_contract('NumTest');
set_txn_hash = my_contract.transact().NumTest();
contract_address = unmigrated_chain.wait.for_receipt(set_txn_hash)
output = my_contract.call().number();
print(output);
Thank you for your valuable time and help.