Skip to content

Commit

Permalink
fix: resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 committed Oct 12, 2023
1 parent 8e39073 commit 03e8440
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "lib/buffer"]
path = lib/buffer
url = https://github.com/ensdomains/buffer
[submodule "lib/pyth-sdk-solidity"]
path = lib/pyth-sdk-solidity
url = https://github.com/pyth-network/pyth-sdk-solidity
31 changes: 31 additions & 0 deletions src/libraries/LibRNSDomain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,35 @@ library LibRNSDomain {
hashed := keccak256(add(label, 32), mload(label))
}
}

/**
* @dev Returns the length of a given string
*
* @param s The string to measure the length of
* @return The length of the input string
*/
function strlen(string memory s) internal pure returns (uint256) {
unchecked {
uint256 i;
uint256 len;
uint256 bytelength = bytes(s).length;
for (len; i < bytelength; len++) {
bytes1 b = bytes(s)[i];
if (b < 0x80) {
i += 1;
} else if (b < 0xE0) {
i += 2;
} else if (b < 0xF0) {
i += 3;
} else if (b < 0xF8) {
i += 4;
} else if (b < 0xFC) {
i += 5;
} else {
i += 6;
}
}
return len;
}
}
}

0 comments on commit 03e8440

Please sign in to comment.