mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-02 12:48:13 +00:00
got past init
This commit is contained in:
+16
-5
@@ -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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user