mirror of
https://github.com/Ed94/refactor.git
synced 2024-12-22 06:54:44 -08:00
Update zpl.h.refactor to expose chang ehte native typedefs.
Updated zpl to original state. (Will require minor refactor of the radix sort to compile in the processed version).
This commit is contained in:
parent
581afa9154
commit
3e6ede0fbe
@ -73,20 +73,7 @@ do \
|
|||||||
while(0) \
|
while(0) \
|
||||||
|
|
||||||
|
|
||||||
using c8 = char;
|
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
||||||
using u8 = zpl_u8;
|
|
||||||
using u16 = zpl_u16;
|
|
||||||
using u32 = zpl_u32;
|
|
||||||
using u64 = zpl_u64;
|
|
||||||
using s8 = zpl_i8;
|
|
||||||
using s16 = zpl_i16;
|
|
||||||
using s32 = zpl_i32;
|
|
||||||
using s64 = zpl_i64;
|
|
||||||
using uw = zpl_usize;
|
|
||||||
using sw = zpl_isize;
|
|
||||||
|
|
||||||
|
|
||||||
ct c8 const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
|
||||||
|
|
||||||
|
|
||||||
namespace Memory
|
namespace Memory
|
||||||
|
@ -26,7 +26,7 @@ namespace File
|
|||||||
|
|
||||||
if ( error_src == ZPL_FILE_ERROR_NONE )
|
if ( error_src == ZPL_FILE_ERROR_NONE )
|
||||||
{
|
{
|
||||||
zpl_isize fsize = zpl_cast(zpl_isize) file_size( & file_src);
|
sw fsize = zpl_cast(sw) file_size( & file_src);
|
||||||
|
|
||||||
if ( fsize > 0 )
|
if ( fsize > 0 )
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ namespace Spec
|
|||||||
}
|
}
|
||||||
|
|
||||||
ct
|
ct
|
||||||
c8 strlen_tok( Tok tok )
|
char strlen_tok( Tok tok )
|
||||||
{
|
{
|
||||||
ct
|
ct
|
||||||
const u8 tok_to_len[ Tok::Num_Tok ] =
|
const u8 tok_to_len[ Tok::Num_Tok ] =
|
||||||
|
@ -23,18 +23,18 @@ word zpl_strncmp, str_compare
|
|||||||
word zpl_strcmp, str_compare
|
word zpl_strcmp, str_compare
|
||||||
|
|
||||||
// Undesired typedefs
|
// Undesired typedefs
|
||||||
not word zpl_i8
|
word zpl_i8, s8
|
||||||
not word zpl_i16
|
word zpl_i16, s16
|
||||||
not word zpl_i32
|
word zpl_i32, s32
|
||||||
not word zpl_i64
|
word zpl_i64, s64
|
||||||
not word zpl_u8
|
word zpl_u8, u8
|
||||||
not word zpl_u16
|
word zpl_u16, u16
|
||||||
not word zpl_u32
|
word zpl_u32, u32
|
||||||
not word zpl_u64
|
word zpl_u64, u64
|
||||||
not word zpl_intptr
|
word zpl_intptr, sptr
|
||||||
not word zpl_uintptr
|
word zpl_uintptr, uptr
|
||||||
not word zpl_usize
|
word zpl_usize, uw
|
||||||
not word zpl_isize
|
word zpl_isize, sw
|
||||||
|
|
||||||
// Undesired exposures.
|
// Undesired exposures.
|
||||||
not word zpl_allocator
|
not word zpl_allocator
|
||||||
|
File diff suppressed because it is too large
Load Diff
36
thirdparty/zpl.h
vendored
36
thirdparty/zpl.h
vendored
@ -6052,12 +6052,12 @@ License:
|
|||||||
|
|
||||||
// NOTE: the count of temp == count of items
|
// NOTE: the count of temp == count of items
|
||||||
#define zpl_radix_sort(Type) zpl_radix_sort_##Type
|
#define zpl_radix_sort(Type) zpl_radix_sort_##Type
|
||||||
#define ZPL_RADIX_SORT_PROC(Type) void zpl_radix_sort(Type)(Type * items, Type * temp, zpl_isize count)
|
#define ZPL_RADIX_SORT_PROC(Type) void zpl_radix_sort(Type)(zpl_##Type * items, zpl_##Type * temp, zpl_isize count)
|
||||||
|
|
||||||
ZPL_DEF ZPL_RADIX_SORT_PROC(zpl_u8);
|
ZPL_DEF ZPL_RADIX_SORT_PROC(u8);
|
||||||
ZPL_DEF ZPL_RADIX_SORT_PROC(zpl_u16);
|
ZPL_DEF ZPL_RADIX_SORT_PROC(u16);
|
||||||
ZPL_DEF ZPL_RADIX_SORT_PROC(zpl_u32);
|
ZPL_DEF ZPL_RADIX_SORT_PROC(u32);
|
||||||
ZPL_DEF ZPL_RADIX_SORT_PROC(zpl_u64);
|
ZPL_DEF ZPL_RADIX_SORT_PROC(u64);
|
||||||
|
|
||||||
//! Performs binary search on an array.
|
//! Performs binary search on an array.
|
||||||
|
|
||||||
@ -12063,16 +12063,16 @@ License:
|
|||||||
|
|
||||||
#define ZPL_RADIX_SORT_PROC_GEN(Type) \
|
#define ZPL_RADIX_SORT_PROC_GEN(Type) \
|
||||||
ZPL_RADIX_SORT_PROC(Type) { \
|
ZPL_RADIX_SORT_PROC(Type) { \
|
||||||
Type *source = items; \
|
zpl_##Type *source = items; \
|
||||||
Type *dest = temp; \
|
zpl_##Type *dest = temp; \
|
||||||
zpl_isize byte_index, i, byte_max = 8 * zpl_size_of(Type); \
|
zpl_isize byte_index, i, byte_max = 8 * zpl_size_of(zpl_##Type); \
|
||||||
for (byte_index = 0; byte_index < byte_max; byte_index += 8) { \
|
for (byte_index = 0; byte_index < byte_max; byte_index += 8) { \
|
||||||
zpl_isize offsets[256] = { 0 }; \
|
zpl_isize offsets[256] = { 0 }; \
|
||||||
zpl_isize total = 0; \
|
zpl_isize total = 0; \
|
||||||
/* NOTE: First pass - count how many of each key */ \
|
/* NOTE: First pass - count how many of each key */ \
|
||||||
for (i = 0; i < count; i++) { \
|
for (i = 0; i < count; i++) { \
|
||||||
Type radix_value = source[i]; \
|
zpl_##Type radix_value = source[i]; \
|
||||||
Type radix_piece = (radix_value >> byte_index) & 0xff; \
|
zpl_##Type radix_piece = (radix_value >> byte_index) & 0xff; \
|
||||||
offsets[radix_piece]++; \
|
offsets[radix_piece]++; \
|
||||||
} \
|
} \
|
||||||
/* NOTE: Change counts to offsets */ \
|
/* NOTE: Change counts to offsets */ \
|
||||||
@ -12083,18 +12083,18 @@ License:
|
|||||||
} \
|
} \
|
||||||
/* NOTE: Second pass - place elements into the right location */ \
|
/* NOTE: Second pass - place elements into the right location */ \
|
||||||
for (i = 0; i < count; i++) { \
|
for (i = 0; i < count; i++) { \
|
||||||
Type radix_value = source[i]; \
|
zpl_##Type radix_value = source[i]; \
|
||||||
Type radix_piece = (radix_value >> byte_index) & 0xff; \
|
zpl_##Type radix_piece = (radix_value >> byte_index) & 0xff; \
|
||||||
dest[offsets[radix_piece]++] = source[i]; \
|
dest[offsets[radix_piece]++] = source[i]; \
|
||||||
} \
|
} \
|
||||||
zpl_swap(Type *, source, dest); \
|
zpl_swap(zpl_##Type *, source, dest); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
ZPL_RADIX_SORT_PROC_GEN(zpl_u8);
|
ZPL_RADIX_SORT_PROC_GEN(u8);
|
||||||
ZPL_RADIX_SORT_PROC_GEN(zpl_u16);
|
ZPL_RADIX_SORT_PROC_GEN(u16);
|
||||||
ZPL_RADIX_SORT_PROC_GEN(zpl_u32);
|
ZPL_RADIX_SORT_PROC_GEN(u32);
|
||||||
ZPL_RADIX_SORT_PROC_GEN(zpl_u64);
|
ZPL_RADIX_SORT_PROC_GEN(u64);
|
||||||
|
|
||||||
void zpl_shuffle(void *base, zpl_isize count, zpl_isize size) {
|
void zpl_shuffle(void *base, zpl_isize count, zpl_isize size) {
|
||||||
zpl_u8 *a;
|
zpl_u8 *a;
|
||||||
@ -18366,4 +18366,4 @@ License:
|
|||||||
// source/core/sort.c
|
// source/core/sort.c
|
||||||
// source/core/file_tar.c
|
// source/core/file_tar.c
|
||||||
// source/opts.c
|
// source/opts.c
|
||||||
// source/math.c
|
// source/math.c
|
||||||
|
Loading…
Reference in New Issue
Block a user