mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow ambiguous conversions between number literals and bytesXX types.
This commit is contained in:
@@ -83,23 +83,23 @@ library strings {
|
||||
uint ret;
|
||||
if (self == 0)
|
||||
return 0;
|
||||
if (self & 0xffffffffffffffffffffffffffffffff == 0) {
|
||||
if (uint256(self) & 0xffffffffffffffffffffffffffffffff == 0) {
|
||||
ret += 16;
|
||||
self = bytes32(uint(self) / 0x100000000000000000000000000000000);
|
||||
}
|
||||
if (self & 0xffffffffffffffff == 0) {
|
||||
if (uint256(self) & 0xffffffffffffffff == 0) {
|
||||
ret += 8;
|
||||
self = bytes32(uint(self) / 0x10000000000000000);
|
||||
}
|
||||
if (self & 0xffffffff == 0) {
|
||||
if (uint256(self) & 0xffffffff == 0) {
|
||||
ret += 4;
|
||||
self = bytes32(uint(self) / 0x100000000);
|
||||
}
|
||||
if (self & 0xffff == 0) {
|
||||
if (uint256(self) & 0xffff == 0) {
|
||||
ret += 2;
|
||||
self = bytes32(uint(self) / 0x10000);
|
||||
}
|
||||
if (self & 0xff == 0) {
|
||||
if (uint256(self) & 0xff == 0) {
|
||||
ret += 1;
|
||||
}
|
||||
return 32 - ret;
|
||||
|
||||
Reference in New Issue
Block a user