From 308b25674748e547d7ddc0d6883347f39a8cb4e0 Mon Sep 17 00:00:00 2001 From: Micke <155267459+reallesee@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:21:33 +0200 Subject: [PATCH] Optimize toHex function in CommonData.cpp --- libsolutil/CommonData.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsolutil/CommonData.cpp b/libsolutil/CommonData.cpp index 7b86bae9f46f..b1fbd0804f5a 100644 --- a/libsolutil/CommonData.cpp +++ b/libsolutil/CommonData.cpp @@ -59,8 +59,9 @@ std::string solidity::util::toHex(bytes const& _data, HexPrefix _prefix, HexCase size_t i = 0; if (_prefix == HexPrefix::Add) { - ret[i++] = '0'; - ret[i++] = 'x'; + ret[0] = '0'; + ret[1] = 'x'; + i = 2; } // Mixed case will be handled inside the loop.