From 3101baec6ec2ed009f81eb74db3cf3bd022214d4 Mon Sep 17 00:00:00 2001 From: Zhi Zhang Date: Mon, 3 Jun 2019 05:09:49 +0800 Subject: [PATCH] modify to meet 0.5.x solidity compiling rules --- src/strings.sol | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/strings.sol b/src/strings.sol index b449645a..075e17b6 100644 --- a/src/strings.sol +++ b/src/strings.sol @@ -34,7 +34,7 @@ * corresponding to the left and right parts of the string. */ -pragma solidity ^0.4.14; +pragma solidity >0.4.13 <0.7.0; library strings { struct slice { @@ -83,23 +83,23 @@ library strings { uint ret; if (self == 0) return 0; - if (self & 0xffffffffffffffffffffffffffffffff == 0) { + if (uint(self) & 0xffffffffffffffffffffffffffffffff == 0) { ret += 16; self = bytes32(uint(self) / 0x100000000000000000000000000000000); } - if (self & 0xffffffffffffffff == 0) { + if (uint(self) & 0xffffffffffffffff == 0) { ret += 8; self = bytes32(uint(self) / 0x10000000000000000); } - if (self & 0xffffffff == 0) { + if (uint(self) & 0xffffffff == 0) { ret += 4; self = bytes32(uint(self) / 0x100000000); } - if (self & 0xffff == 0) { + if (uint(self) & 0xffff == 0) { ret += 2; self = bytes32(uint(self) / 0x10000); } - if (self & 0xff == 0) { + if (uint(self) & 0xff == 0) { ret += 1; } return 32 - ret; @@ -702,7 +702,7 @@ library strings { uint retptr; assembly { retptr := add(ret, 32) } - for(i = 0; i < parts.length; i++) { + for(uint i = 0; i < parts.length; i++) { memcpy(retptr, parts[i]._ptr, parts[i]._len); retptr += parts[i]._len; if (i < parts.length - 1) {