File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -958,10 +958,10 @@ <h1 id="optimization-3-fast-digit-counting">Optimization #3: Fast Digit Counting
958958---
959959How Fast Digit Counting Works
960960
961- The Problem: < span class =" hljs-function " > Need to know buffer size before converting number to string
961+ The Problem: Need to know buffer size before converting number to string
962962
963- Traditional < span class =" hljs-title " > Approach</ span > < span class =" hljs-params " > (Disabled by NO_FAST_DIGITS) </ span > :
964- size_t digit_count( uint64_t v) { </ span >
963+ Traditional Approach:
964+ < span class =" hljs-function " > < span class =" hljs-type " > size_t</ span > < span class =" hljs-title " > digit_count</ span > < span class =" hljs-params " > ( < span class =" hljs-type " > uint64_t</ span > v)</ span > </ span > {
965965 < span class ="hljs-keyword "> return</ span > std::< span class ="hljs-built_in "> to_string</ span > (v).< span class ="hljs-built_in "> length</ span > ();
966966 < span class ="hljs-comment "> // 1. Allocates memory</ span >
967967 < span class ="hljs-comment "> // 2. Converts entire number to string</ span >
Original file line number Diff line number Diff line change @@ -1068,7 +1068,7 @@ How Fast Digit Counting Works
10681068
10691069The Problem: Need to know buffer size before converting number to string
10701070
1071- Traditional Approach (Disabled by NO_FAST_DIGITS) :
1071+ Traditional Approach:
10721072size_t digit_count(uint64_t v) {
10731073 return std::to_string(v).length();
10741074 // 1. Allocates memory
You can’t perform that action at this time.
0 commit comments