43 lines
1.6 KiB
C
43 lines
1.6 KiB
C
#ifndef INCLUDED_C_LSD_H
|
||||
|
|
#define INCLUDED_C_LSD_H
|
|||
|
|
|
|||
|
|
#ifndef INCLUDED_C_TYPES_H
|
|||
|
|
#include <c_Types.h>
|
|||
|
|
#endif /*INCLUDED_C_TYPES_H*/
|
|||
|
|
|
|||
|
|
#ifndef INCLUDED_C_ALLOCATOR_H
|
|||
|
|
#include <c_Allocator.h>
|
|||
|
|
#endif /*INCLUDED_C_ALLOCATOR_H*/
|
|||
|
|
|
|||
|
|
|
|||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|||
|
|
/* */
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 泛型 LSD 专用字节密钥提取器函数指针
|
|||
|
|
*
|
|||
|
|
* @param elem 指向当前泛型待提取对象的指针
|
|||
|
|
* @param d 当前从低向高扫描的第 d 个字节下标位置(0 代表最低位字节,W-1 代表最高位字节)
|
|||
|
|
* @param args 自定义上下文参数指针
|
|||
|
|
* @return uint8_t 返回该泛型对象在第 d 个字节处的物理 8 位无符号整型键值 [0, 255]
|
|||
|
|
*/
|
|||
|
|
typedef uint8_t (*c_LSD_ExtractorFn)(const void* elem, c_size_t d, void* args);
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 工业级泛型低位优先(LSD)基数排序核心接口(分配器内联组合版)
|
|||
|
|
*
|
|||
|
|
* @param base 指向待排序连续数组首元素的指针
|
|||
|
|
* @param num 数组中元素的总个数 (N)
|
|||
|
|
* @param elem_size 单个泛型元素对象占用的字节体量 (sizeof)
|
|||
|
|
* @param w_bytes 该泛型对象的排序密钥的总定长字节宽度 (W)
|
|||
|
|
* @param extractor 字节提取器回调虚操作函数指针 (不能为 NULL)
|
|||
|
|
* @param args 自定义上下文参数指针
|
|||
|
|
* @param allocator 用户自制的分配器指针(传入 NULL 则自动降级调用 c_DefaultAllocator)
|
|||
|
|
*/
|
|||
|
|
c_err_t c_LSD_RadixSort(void* base, c_size_t num, c_size_t elem_size, c_size_t w_bytes,
|
|||
|
|
c_LSD_ExtractorFn extractor, void* args, c_Allocator_t* allocator);
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endif /*INCLUDED_C_LSD_H*/
|