mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-27 07:51:49 -07:00
Remove code relating to default struct values
This commit is contained in:
+14
-12
@@ -3673,7 +3673,8 @@ gb_inline void *gb_memcopy(void *dest, void const *source, isize n) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__asm__ __volatile__("rep movsb" : "+D"(dest), "+S"(source), "+c"(n) : : "memory");
|
||||
void *dest_copy = dest;
|
||||
__asm__ __volatile__("rep movsb" : "+D"(dest_copy), "+S"(source), "+c"(n) : : "memory");
|
||||
#else
|
||||
u8 *d = cast(u8 *)dest;
|
||||
u8 const *s = cast(u8 const *)source;
|
||||
@@ -3798,12 +3799,15 @@ gb_inline void *gb_memcopy(void *dest, void const *source, isize n) {
|
||||
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
||||
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
||||
}
|
||||
if (n & 4)
|
||||
if (n & 4) {
|
||||
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
||||
if (n & 2)
|
||||
}
|
||||
if (n & 2) {
|
||||
*d++ = *s++; *d++ = *s++;
|
||||
if (n & 1)
|
||||
}
|
||||
if (n & 1) {
|
||||
*d = *s;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4027,10 +4031,10 @@ gb_inline void *gb_resize (gbAllocator a, void *ptr, isize old_size, isize
|
||||
gb_inline void *gb_resize_align(gbAllocator a, void *ptr, isize old_size, isize new_size, isize alignment) { return a.proc(a.data, gbAllocation_Resize, new_size, alignment, ptr, old_size, GB_DEFAULT_ALLOCATOR_FLAGS); }
|
||||
|
||||
gb_inline void *gb_alloc_copy (gbAllocator a, void const *src, isize size) {
|
||||
return gb_memmove(gb_alloc(a, size), src, size);
|
||||
return gb_memcopy(gb_alloc(a, size), src, size);
|
||||
}
|
||||
gb_inline void *gb_alloc_copy_align(gbAllocator a, void const *src, isize size, isize alignment) {
|
||||
return gb_memmove(gb_alloc_align(a, size, alignment), src, size);
|
||||
return gb_memcopy(gb_alloc_align(a, size, alignment), src, size);
|
||||
}
|
||||
|
||||
gb_inline char *gb_alloc_str(gbAllocator a, char const *str) {
|
||||
@@ -4039,8 +4043,7 @@ gb_inline char *gb_alloc_str(gbAllocator a, char const *str) {
|
||||
|
||||
gb_inline char *gb_alloc_str_len(gbAllocator a, char const *str, isize len) {
|
||||
char *result;
|
||||
result = cast(char *)gb_alloc(a, len+1);
|
||||
gb_memmove(result, str, len);
|
||||
result = cast(char *)gb_alloc_copy(a, str, len+1);
|
||||
result[len] = '\0';
|
||||
return result;
|
||||
}
|
||||
@@ -6548,7 +6551,7 @@ gbString gb_string_make_length(gbAllocator a, void const *init_str, isize num_by
|
||||
header->allocator = a;
|
||||
header->length = num_bytes;
|
||||
header->capacity = num_bytes;
|
||||
if (num_bytes > 0 && init_str) {
|
||||
if (num_bytes && init_str) {
|
||||
gb_memcopy(str, init_str, num_bytes);
|
||||
}
|
||||
str[num_bytes] = '\0';
|
||||
@@ -8480,9 +8483,9 @@ gb_no_inline isize gb_snprintf_va(char *text, isize max_len, char const *fmt, va
|
||||
int width = va_arg(va, int);
|
||||
if (width < 0) {
|
||||
info.flags |= gbFmt_Minus;
|
||||
info.width = -info.width;
|
||||
info.width = -width;
|
||||
} else {
|
||||
info.width = -info.width;
|
||||
info.width = width;
|
||||
}
|
||||
fmt++;
|
||||
} else {
|
||||
@@ -10813,4 +10816,3 @@ GB_COMPARE_PROC(gb_video_mode_dsc_cmp) {
|
||||
#endif
|
||||
|
||||
#endif // GB_IMPLEMENTATION
|
||||
|
||||
|
||||
Reference in New Issue
Block a user