Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux