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:
Edward R. Gonzalez 2023-03-12 22:13:18 -04:00
parent 581afa9154
commit 3e6ede0fbe
5 changed files with 1457 additions and 1470 deletions

View File

@ -73,20 +73,7 @@ do \
while(0) \
using c8 = char;
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";
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
namespace Memory

View File

@ -26,7 +26,7 @@ namespace File
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 )
{
@ -94,7 +94,7 @@ namespace Spec
}
ct
c8 strlen_tok( Tok tok )
char strlen_tok( Tok tok )
{
ct
const u8 tok_to_len[ Tok::Num_Tok ] =

View File

@ -23,18 +23,18 @@ word zpl_strncmp, str_compare
word zpl_strcmp, str_compare
// Undesired typedefs
not word zpl_i8
not word zpl_i16
not word zpl_i32
not word zpl_i64
not word zpl_u8
not word zpl_u16
not word zpl_u32
not word zpl_u64
not word zpl_intptr
not word zpl_uintptr
not word zpl_usize
not word zpl_isize
word zpl_i8, s8
word zpl_i16, s16
word zpl_i32, s32
word zpl_i64, s64
word zpl_u8, u8
word zpl_u16, u16
word zpl_u32, u32
word zpl_u64, u64
word zpl_intptr, sptr
word zpl_uintptr, uptr
word zpl_usize, uw
word zpl_isize, sw
// Undesired exposures.
not word zpl_allocator

File diff suppressed because it is too large Load Diff

34
thirdparty/zpl.h vendored
View File

@ -6052,12 +6052,12 @@ License:
// NOTE: the count of temp == count of items
#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(zpl_u16);
ZPL_DEF ZPL_RADIX_SORT_PROC(zpl_u32);
ZPL_DEF ZPL_RADIX_SORT_PROC(zpl_u64);
ZPL_DEF ZPL_RADIX_SORT_PROC(u8);
ZPL_DEF ZPL_RADIX_SORT_PROC(u16);
ZPL_DEF ZPL_RADIX_SORT_PROC(u32);
ZPL_DEF ZPL_RADIX_SORT_PROC(u64);
//! Performs binary search on an array.
@ -12063,16 +12063,16 @@ License:
#define ZPL_RADIX_SORT_PROC_GEN(Type) \
ZPL_RADIX_SORT_PROC(Type) { \
Type *source = items; \
Type *dest = temp; \
zpl_isize byte_index, i, byte_max = 8 * zpl_size_of(Type); \
zpl_##Type *source = items; \
zpl_##Type *dest = temp; \
zpl_isize byte_index, i, byte_max = 8 * zpl_size_of(zpl_##Type); \
for (byte_index = 0; byte_index < byte_max; byte_index += 8) { \
zpl_isize offsets[256] = { 0 }; \
zpl_isize total = 0; \
/* NOTE: First pass - count how many of each key */ \
for (i = 0; i < count; i++) { \
Type radix_value = source[i]; \
Type radix_piece = (radix_value >> byte_index) & 0xff; \
zpl_##Type radix_value = source[i]; \
zpl_##Type radix_piece = (radix_value >> byte_index) & 0xff; \
offsets[radix_piece]++; \
} \
/* NOTE: Change counts to offsets */ \
@ -12083,18 +12083,18 @@ License:
} \
/* NOTE: Second pass - place elements into the right location */ \
for (i = 0; i < count; i++) { \
Type radix_value = source[i]; \
Type radix_piece = (radix_value >> byte_index) & 0xff; \
zpl_##Type radix_value = source[i]; \
zpl_##Type radix_piece = (radix_value >> byte_index) & 0xff; \
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(zpl_u16);
ZPL_RADIX_SORT_PROC_GEN(zpl_u32);
ZPL_RADIX_SORT_PROC_GEN(zpl_u64);
ZPL_RADIX_SORT_PROC_GEN(u8);
ZPL_RADIX_SORT_PROC_GEN(u16);
ZPL_RADIX_SORT_PROC_GEN(u32);
ZPL_RADIX_SORT_PROC_GEN(u64);
void zpl_shuffle(void *base, zpl_isize count, zpl_isize size) {
zpl_u8 *a;