[libc-commits] [libc] [libc] Add cpp::swap and cpp::clamp utilities (PR #221236)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Fri Sep 4 09:10:35 PDT 2026


================
@@ -146,15 +152,14 @@ template <typename ArgProvider> class Parser {
             // Technically there is no requirement to correct the ordering of
             // the range, but since the range operator is entirely
             // implementation defined it seems like a good convenience.
-            char a = str[cur_pos - 1];
-            char b = str[cur_pos + 1];
-            char start = (a < b ? a : b);
-            char end = (a < b ? b : a);
-            scan_set.set_range(static_cast<size_t>(start),
-                               static_cast<size_t>(end));
+            uint8_t a = static_cast<uint8_t>(str[cur_pos - 1]);
----------------
vonosmas wrote:

Not sure if this would be problematic once we start supporting wide character strings ( @strel-12 FYI )

https://github.com/llvm/llvm-project/pull/221236


More information about the libc-commits mailing list