diff options
author | Christian <c@ethdev.com> | 2014-11-05 18:38:26 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-06 09:40:39 +0800 |
commit | b5e77678c9257f97be89139cf1d12bfa178147ef (patch) | |
tree | 786dbb9a1efb03b4284412fe85e5959b7195f1fa /Types.cpp | |
parent | 95d2edfbac4dff62ac987a9fe0fc58fbce76e5b7 (diff) | |
download | dexon-solidity-b5e77678c9257f97be89139cf1d12bfa178147ef.tar.gz dexon-solidity-b5e77678c9257f97be89139cf1d12bfa178147ef.tar.zst dexon-solidity-b5e77678c9257f97be89139cf1d12bfa178147ef.zip |
Keywords for all integer types.
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -40,16 +40,14 @@ shared_ptr<Type> Type::fromElementaryTypeName(Token::Value _typeToken) if (Token::INT <= _typeToken && _typeToken <= Token::HASH256) { int offset = _typeToken - Token::INT; - int bits = offset % 5; - if (bits == 0) - bits = 256; - else - bits = (1 << (bits - 1)) * 32; - int modifier = offset / 5; - return make_shared<IntegerType>(bits, - modifier == 0 ? IntegerType::Modifier::SIGNED : - modifier == 1 ? IntegerType::Modifier::UNSIGNED : - IntegerType::Modifier::HASH); + int bytes = offset % 33; + if (bytes == 0) + bytes = 32; + int modifier = offset / 33; + return make_shared<IntegerType>(bytes * 8, + modifier == 0 ? IntegerType::Modifier::SIGNED : + modifier == 1 ? IntegerType::Modifier::UNSIGNED : + IntegerType::Modifier::HASH); } else if (_typeToken == Token::ADDRESS) return make_shared<IntegerType>(0, IntegerType::Modifier::ADDRESS); |