MonkOS
v0.1
A simple 64-bit operating system (x86_64)
stdlib.h
Go to the documentation of this file.
1
//============================================================================
2
/// @file stdlib.h
3
/// @brief General utilities library.
4
//
5
// Copyright 2016 Brett Vickers.
6
// Use of this source code is governed by a BSD-style license that can
7
// be found in the MonkOS LICENSE file.
8
//============================================================================
9
10
#pragma once
11
12
#include <
core.h
>
13
14
//----------------------------------------------------------------------------
15
// @typedef sortcmp
16
/// @brief Comparison function pointer type for use with the qsort
17
/// function.
18
/// @param[in] a Pointer to first element to be compared.
19
/// @param[in] b Pointer to second element to be compared.
20
/// @returns <0 if the element pointed to by a should go before the
21
/// element pointed to by b.
22
///
23
/// 0 if the elements sort equivalently.
24
///
25
/// >0 if the element pointed to by a should go after the
26
/// element pointed to by b.
27
//----------------------------------------------------------------------------
28
typedef
int (*
sortcmp
)(
const
void
*a,
const
void
*b);
29
30
//----------------------------------------------------------------------------
31
// @function qsort
32
/// @brief Sort the elements of an array using a sort comparison
33
/// function.
34
/// @details Sorts a contiguous array of \b num elements pointed to by
35
/// \b base, where each element is \b size bytes long.
36
/// @param[in] base Pointer to the first element in the array.
37
/// @param[in] num Number of element in the array to be sorted.
38
/// @param[in] size Size of each element in bytes.
39
/// @param[in] cmp Pointer to a function that compares two elements.
40
//----------------------------------------------------------------------------
41
void
42
qsort
(
void
*base,
size_t
num,
size_t
size,
sortcmp
cmp);
core.h
Core include file.
sortcmp
int(* sortcmp)(const void *a, const void *b)
Comparison function pointer type for use with the qsort function.
Definition:
stdlib.h:28
qsort
void qsort(void *base, size_t num, size_t size, sortcmp cmp)
Sort the elements of an array using a sort comparison function.
include
libc
stdlib.h
Generated by
1.8.11