Code quality upkeep. Fixed a broken thread finding assembly instruction in gb.h

This commit is contained in:
Zachary Pierson
2017-02-09 01:40:45 -06:00
parent 7f6b83d50c
commit 3445a28c4a
2 changed files with 18 additions and 12 deletions
+5 -2
View File
@@ -3630,7 +3630,10 @@ gb_inline void *gb_memcopy(void *dest, void const *source, isize n) {
__movsb(cast(u8 *)dest, cast(u8 *)source, n);
#elif defined(GB_SYSTEM_OSX) || defined(GB_SYSTEM_UNIX)
// NOTE(zangent): I assume there's a reason this isn't being used elsewhere,
// but I don't see it and I can't seem to get this working any other way.
// but casting pointers as arguments to an __asm__ call is considered an
// error on MacOS and (I think) Linux
// TODO(zangent): Figure out how to refactor the asm code so it works on MacOS,
// since this is probably not the way the author intended this to work.
memcpy(dest, source, n);
#elif defined(GB_CPU_X86)
@@ -4684,7 +4687,7 @@ gb_inline u32 gb_thread_current_id(void) {
#elif defined(GB_ARCH_32_BIT) && defined(GB_CPU_X86)
__asm__("mov %%gs:0x08,%0" : "=r"(thread_id));
#elif defined(GB_ARCH_64_BIT) && defined(GB_CPU_X86)
__asm__("mov %%gs:0x10,%0" : "=r"(thread_id));
__asm__("mov %%fs:0x10,%0" : "=r"(thread_id));
#else
#error Unsupported architecture for gb_thread_current_id()
#endif