On 2024-09-25 15:10, Mathieu Desnoyers wrote: [...] Cleaner without goto in the user code:
#include <stdio.h> #include <stdbool.h> static inline bool same_ptr(void *a, void *b) { asm goto ( "cmpq %[a], %[b]\n\t" "jne %l[ne]\n\t" : : [a] "r" (a), [b] "r" (b) : : ne); return true; ne: return false; } int x; int v[2]; int main(void) { if (same_ptr(v, v + 1)) x = 1; printf("%d\n", x); return 0; } -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com