Skip to content

Commit

Permalink
Merge pull request #14 from oxen-io/reserve-vector
Browse files Browse the repository at this point in the history
reserve vector length in fromHexString
  • Loading branch information
darcys22 authored Apr 23, 2024
2 parents 9a914dc + 4867619 commit 209daad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ std::vector<unsigned char> utils::fromHexString(std::string_view hexStr) {
assert(hexStr.size() % 2 == 0);

std::vector<unsigned char> result;
result.reserve(hexStr.length() / 2);
for (size_t i = 0; i < hexStr.length(); i += 2) {
std::string_view byteString = hexStr.substr(i, 2);
HexToU8Result hi = hexToU8(byteString[0]);
Expand Down

0 comments on commit 209daad

Please sign in to comment.