mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
Provide basic type safety for array_pod_sort comparators.
This makes using array_pod_sort significantly safer. The implementation relies on function pointer casting but that should be safe as we're dealing with void* here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191175 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -699,9 +699,10 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
static int ConstantIntSortPredicate(const void *P1, const void *P2) {
|
||||
const ConstantInt *LHS = *(const ConstantInt*const*)P1;
|
||||
const ConstantInt *RHS = *(const ConstantInt*const*)P2;
|
||||
static int ConstantIntSortPredicate(ConstantInt *const *P1,
|
||||
ConstantInt *const *P2) {
|
||||
const ConstantInt *LHS = *P1;
|
||||
const ConstantInt *RHS = *P2;
|
||||
if (LHS->getValue().ult(RHS->getValue()))
|
||||
return 1;
|
||||
if (LHS->getValue() == RHS->getValue())
|
||||
|
||||
Reference in New Issue
Block a user