Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BLI_sort_utils.h « blenlib « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8950df4f2249c2725d1e0fd4ed92cb35862c9aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright 2013 Blender Foundation. All rights reserved. */

#pragma once

/** \file
 * \ingroup bli
 */

#ifdef __cplusplus
extern "C" {
#endif

/**
 * \note keep \a sort_value first,
 * so cmp functions can be reused.
 */
struct SortPtrByFloat {
  float sort_value;
  void *data;
};

struct SortIntByFloat {
  float sort_value;
  int data;
};

struct SortPtrByInt {
  int sort_value;
  void *data;
};

struct SortIntByInt {
  int sort_value;
  int data;
};

int BLI_sortutil_cmp_float(const void *a_, const void *b_);
int BLI_sortutil_cmp_float_reverse(const void *a_, const void *b_);

int BLI_sortutil_cmp_int(const void *a_, const void *b_);
int BLI_sortutil_cmp_int_reverse(const void *a_, const void *b_);

int BLI_sortutil_cmp_ptr(const void *a_, const void *b_);
int BLI_sortutil_cmp_ptr_reverse(const void *a_, const void *b_);

#ifdef __cplusplus
}
#endif