[libcxx-commits] [PATCH] D78763: Add optimization to basic_string::assign for compile-time known constant values.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 29 12:00:37 PDT 2020


ldionne added inline comments.


================
Comment at: libcxx/include/string:2306
     _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr");
-    return (__builtin_constant_p(__n) && __n <= 128 / sizeof(value_type))
-               ? __assign_small_length(__s, __n)
+    return (_LIBCPP_BUILTIN_CONSTANT_P(__n) && __n < __min_cap)
+               ? __assign_short(__s, __n)
----------------
It used to be `__n <= ...`, now it's `__n < ...` -- what am I missing?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78763/new/

https://reviews.llvm.org/D78763





More information about the libcxx-commits mailing list