Fixup and polish chibicc some more

Fixes #433
This commit is contained in:
Justine Tunney 2022-06-20 04:32:25 -07:00
parent a988896048
commit f317a47cd8
15 changed files with 315 additions and 253 deletions

View file

@ -9,13 +9,14 @@ bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
#if defined(__GCC_ASM_FLAG_OUTPUTS__) && !defined(__STRICT_ANSI__)
#define IsAtLeastWindows10() (GetNtMajorVersion() >= 10)
static pureconst inline unsigned char GetNtMajorVersion(void) {
uintptr_t _x;
asm("mov\t%%gs:96,%q0\r\n"
"mov\t280(%q0),%b0"
: "=q"(_x));
return _x;
}
#define GetNtMajorVersion() \
({ \
uintptr_t __x; \
asm("mov\t%%gs:96,%q0\r\n" \
"mov\t280(%q0),%b0" \
: "=q"(__x)); \
(unsigned char)__x; \
})
#endif
COSMOPOLITAN_C_END_