github-actions[bot] commented on code in PR #27342: URL: https://github.com/apache/doris/pull/27342#discussion_r1400161558
########## be/src/vec/common/format_ip.cpp: ########## @@ -75,4 +76,125 @@ consteval std::array<std::pair<const char*, size_t>, N> str_make_array() { /// This will generate static array of pair<const char *, size_t> for [0..255] at compile time extern constexpr std::array<std::pair<const char*, size_t>, 256> one_byte_to_string_lookup_table = str_make_array<256>(); + +/// integer logarithm, return ceil(log(value, base)) (the smallest integer greater or equal than log(value, base) +static constexpr UInt32 intLog(const UInt32 value, const UInt32 base, const bool carry) { + return value >= base ? 1 + intLog(value / base, base, value % base || carry) + : value % base > 1 || carry; +} + +/// Print integer in desired base, faster than sprintf. +/// NOTE This is not the best way. See https://github.com/miloyip/itoa-benchmark +/// But it doesn't matter here. +template <UInt32 base, typename T> +static void print_integer(char*& out, T value) { + if (value == 0) { Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (value == 0) { ``` be/src/vec/common/format_ip.cpp:92: ```diff - else { + } else { ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org