@@ -375,22 +375,6 @@ static inline unsigned int OrderedNumLength(uint64_t val) {
375375 return static_cast <unsigned int >(lg + 1 + 7 ) / 8 ;
376376}
377377
378- // Append n bytes from src to *dst.
379- // REQUIRES: n <= 9
380- // REQUIRES: src[0..8] are readable bytes (even if n is smaller)
381- //
382- // If we use string::append() instead of this routine, it increases the
383- // runtime of WriteNumIncreasingSmall/WriteNumDecreasingSmall from ~7ns to
384- // ~13ns.
385- static inline void AppendUpto9 (std::string* dst,
386- const char * src,
387- unsigned int n) {
388- const size_t old_size = dst->size ();
389- absl::strings_internal::STLStringResizeUninitialized (dst, old_size + 9 );
390- memcpy (&(*dst)[old_size], src, 9 );
391- dst->erase (old_size + n);
392- }
393-
394378void OrderedCode::WriteNumIncreasing (std::string* dest, uint64_t num) {
395379 // Values are encoded with a single byte length prefix, followed
396380 // by the actual value in big-endian format with leading 0 bytes
@@ -406,7 +390,7 @@ void OrderedCode::WriteNumIncreasing(std::string* dest, uint64_t num) {
406390 const unsigned int length = OrderedNumLength (num);
407391 char * start = buf + 9 - length - 1 ;
408392 *start = static_cast <char >(length);
409- AppendUpto9 ( dest, start, length + 1 );
393+ dest-> append ( start, length + 1 );
410394}
411395
412396void OrderedCode::WriteNumDecreasing (std::string* dest, uint64_t num) {
@@ -424,7 +408,7 @@ void OrderedCode::WriteNumDecreasing(std::string* dest, uint64_t num) {
424408 const unsigned int length = OrderedNumLength (num);
425409 char * start = buf + 9 - length - 1 ;
426410 *start = static_cast <char >(~length);
427- AppendUpto9 ( dest, start, length + 1 );
411+ dest-> append ( start, length + 1 );
428412}
429413
430414template <bool INVERT>
0 commit comments