@@ -55,13 +55,12 @@ namespace {
5555// / fast, zero-allocation and zero-copy conversion directly
5656// / into the vector's pre-reserved buffer memory.
5757// /
58- void append_prime_as_string (Vector<char >& vect,
59- uint64_t prime)
58+ ALWAYS_INLINE void append_prime_as_string (Vector<char >& vect, uint64_t prime)
6059{
6160 std::size_t old_size = vect.size ();
6261
63- // When converting a 64-bit integer to a
64- // string we need at most 20 characters.
62+ // Converting a 64-bit integer to a string
63+ // requires at most 20 characters.
6564 vect.resize (old_size + 20 );
6665 char * first = &vect[old_size];
6766 char * last = vect.end ();
@@ -79,17 +78,13 @@ void append_prime_as_string(Vector<char>& vect,
7978#else
8079
8180#include < string>
82- #include < cstring>
8381
8482namespace {
8583
86- void append_prime_as_string (Vector<char >& vect,
87- uint64_t prime)
84+ ALWAYS_INLINE void append_prime_as_string (Vector<char >& vect, uint64_t prime)
8885{
8986 std::string str = std::to_string (prime);
90- std::size_t old_size = vect.size ();
91- vect.resize (old_size + str.size ());
92- std::memcpy (&vect[old_size], str.data (), str.size ());
87+ vect.insert (vect.end (), str.begin (), str.end ());
9388}
9489
9590} // namespace
0 commit comments