[RISCV] Reduce redundancy in vnsrl tests
[llvm-project.git] / libc / src / stdlib / qsort_util.h
blobd42adde06d9762aed29f7d892c102e37d083867c
1 //===-- Implementation header for qsort utilities ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H
10 #define LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H
12 #include "src/stdlib/heap_sort.h"
13 #include "src/stdlib/quick_sort.h"
15 #define LIBC_QSORT_QUICK_SORT 1
16 #define LIBC_QSORT_HEAP_SORT 2
18 #ifndef LIBC_QSORT_IMPL
19 #define LIBC_QSORT_IMPL LIBC_QSORT_QUICK_SORT
20 #endif // LIBC_QSORT_IMPL
22 #if (LIBC_QSORT_IMPL != LIBC_QSORT_QUICK_SORT && \
23 LIBC_QSORT_IMPL != LIBC_QSORT_HEAP_SORT)
24 #error "LIBC_QSORT_IMPL is not recognized."
25 #endif
27 namespace LIBC_NAMESPACE_DECL {
28 namespace internal {
30 #if LIBC_QSORT_IMPL == LIBC_QSORT_QUICK_SORT
31 constexpr auto sort = quick_sort;
32 #elif LIBC_QSORT_IMPL == LIBC_QSORT_HEAP_SORT
33 constexpr auto sort = heap_sort;
34 #endif
36 } // namespace internal
37 } // namespace LIBC_NAMESPACE_DECL
39 #endif // LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H