got past init

This commit is contained in:
ed
2025-02-09 05:40:04 -05:00
parent d867a8b0c0
commit 0485058938
9 changed files with 40 additions and 31 deletions
+16 -5
View File
@@ -83,11 +83,20 @@
// TODO(Ed): Review usage of memmove here...(I guess wanting to avoid overlap faults..)
#ifndef memory_copy
# if USE_VENDOR_MEMORY_OPS
# define memory_copy(dst, src, size) memmove((dst), (src), (size))
# if OS_WINDOWS
void* memcpy_intrinsic(void* dest, const void* src, size_t count)
{
if (dest == NULL || src == NULL || count == 0) {
return NULL;
}
__movsb((unsigned char*)dest, (const unsigned char*)src, count);
return dest;
}
# define memory_copy(dst, src, size) memcpy_intrinsic((dst), (src), (size))
# else
# define memory_copy(dst, src, size) mem_move((dst), (src), (size))
#endif
# define memory_copy(dst, src, size) memmove((dst), (src), (size))
# endif
#endif
#ifndef memory_set
# if USE_VENDOR_MEMORY_OPS
@@ -197,8 +206,10 @@ void* mem_move( void* destination, void const* source, SSIZE byte_count )
if ( dest_ptr == src_ptr )
return dest_ptr;
if ( src_ptr + byte_count <= dest_ptr || dest_ptr + byte_count <= src_ptr ) // NOTE: Non-overlapping
// NOTE: Non-overlapping
if ( src_ptr + byte_count <= dest_ptr || dest_ptr + byte_count <= src_ptr ) {
return memory_copy( dest_ptr, src_ptr, byte_count );
}
if ( dest_ptr < src_ptr )
{