forked from sysprog21/lab0-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_sort.h
25 lines (18 loc) · 807 Bytes
/
list_sort.h
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
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_LIST_SORT_H
#define _LINUX_LIST_SORT_H
#include "list.h"
#include "stdint.h"
// likely and unlikely are define in compiler.h
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
// struct list_head;
typedef int
__attribute__((nonnull(2, 3))) (*list_cmp_func_t)(void *,
const struct list_head *,
const struct list_head *);
__attribute__((nonnull(2, 3))) void list_sort(void *priv,
struct list_head *head,
list_cmp_func_t cmp);
void timsort(void *priv, struct list_head *head, list_cmp_func_t cmp);
#endif