diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-08-18 12:24:12 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-08-18 14:26:39 +0100 |
commit | de44eee5d52f5980b6b2b2120940f70cc2fa007e (patch) | |
tree | 250ab418e6450e3c888bd77a575c98b74e2d48b8 /libiberty/simple-object-mach-o.c | |
parent | 085c2f8f0e13d7c1515ce86755a52a31faf0cf47 (diff) | |
download | gcc-de44eee5d52f5980b6b2b2120940f70cc2fa007e.zip gcc-de44eee5d52f5980b6b2b2120940f70cc2fa007e.tar.gz gcc-de44eee5d52f5980b6b2b2120940f70cc2fa007e.tar.bz2 |
libstdc++: Minor optimization for min/max/minmax
The debug mode checks for a valid range are redundant when we have an
initializer_list argument, because we know it's a valid range already.
By making std::min(initialier_list<T>) call the internal __min_element
function directly we avoid a function call and skip those checks. The
same can be done for the overload taking a comparison function, and also
for the std::max and std::minmax overloads for initializer_list
arguments.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/stl_algo.h (min(initializer_list<T>))
(min(initializer_list<T>, Compare)): Call __min_element directly to
avoid redundant debug checks for valid ranges.
(max(initializer_list<T>), max(initializer_list<T>, Compare)):
Likewise, for __max_element.
(minmax(initializer_list<T>), minmax(initializer_list<T>, Compare)):
Likewise, for __minmax_element.
Diffstat (limited to 'libiberty/simple-object-mach-o.c')
0 files changed, 0 insertions, 0 deletions