[all-commits] [llvm/llvm-project] e92c19: [libc] Add cpp::swap and cpp::clamp utilities (#22...
Jeff Bailey via All-commits
all-commits at lists.llvm.org
Mon Sep 7 07:54:44 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e92c19abae25beb03234bfbf6cfa1a431c6d380a
https://github.com/llvm/llvm-project/commit/e92c19abae25beb03234bfbf6cfa1a431c6d380a
Author: Jeff Bailey <jbailey at raspberryginger.com>
Date: 2026-09-07 (Mon, 07 Sep 2026)
Changed paths:
M libc/src/__support/CPP/CMakeLists.txt
M libc/src/__support/CPP/algorithm.h
M libc/src/__support/CPP/utility.h
A libc/src/__support/CPP/utility/swap.h
M libc/src/__support/math/CMakeLists.txt
M libc/src/__support/math/powf.h
M libc/src/__support/wctype/CMakeLists.txt
M libc/src/__support/wctype/perfect_hash_map.h
M libc/src/stdio/scanf_core/CMakeLists.txt
M libc/src/stdio/scanf_core/parser.h
M libc/src/stdlib/CMakeLists.txt
M libc/src/stdlib/qsort_data.h
M libc/test/src/__support/CPP/CMakeLists.txt
M libc/test/src/__support/CPP/algorithm_test.cpp
A libc/test/src/__support/CPP/swap_test.cpp
M libc/test/src/stdio/scanf_core/parser_test.cpp
Log Message:
-----------
[libc] Add cpp::swap and cpp::clamp utilities (#221236)
Added cpp::swap to src/__support/CPP/utility/swap.h with move semantics
and array support, and cpp::clamp to src/__support/CPP/algorithm.h with
comparator support.
Included unit tests in swap_test.cpp and algorithm_test.cpp.
Adopted the new utilities in initial callsites:
* stdlib: Used cpp::swap in qsort_data.h
* wctype: Used cpp::swap in perfect_hash_map.h
* math: Used cpp::clamp in powf.h
* scanf_core: Used cpp::min and cpp::max in parser.h
Also fixed sign extension when parsing scanset specifiers in parser.h:
signed characters greater than or equal to 128 produced negative values,
inverting comparisons and causing out-of-bounds writes in the bitset.
Scanset characters are now cast through uint8_t, and non-ASCII tests
were added to parser_test.cpp.
Assisted-by: Automated tooling, human reviewed.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list