Using condition flags as GNU C inline asm outputs

Starting with GCC6 on x86 you can actually use “=@ccCOND” as output (where COND is any valid x86 condition code). Example originally from here, cleaned up by David’s suggestions: int variable_test_bit(long n, volatile const unsigned long *addr) { int oldbit; asm volatile(“bt %[value],%[bit]” : “=@ccc” (oldbit) : [value] “m” (*addr), [bit] “Jr” (n)); return oldbit; … Read more

Address of labels (MSVC)

The only way of doing this in MSVC is by using inline assembly (which basically buggers you for x64): int _tmain(int argc, _TCHAR* argv[]) { case_1: void* p; __asm{ mov [p],offset case_1 } printf(“0x%p\n”,p); return 0; } If you plan on doing something like this, then the best way would be to write the whole … Read more