[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types
From: |
Elijah Stone |
Subject: |
Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types |
Date: |
Fri, 19 Mar 2021 12:55:28 -0700 (PDT) |
On Fri, 19 Mar 2021, Dmitry Selyutin wrote:
Some complex types can still be small and simple enough to fit into
register. Other compilers allow some operations on these types, and it
seems to be quite a reasonable choice.
How should padding be handled? For example:
struct foo {
uint8_t a;
uint16_t b;
};
struct foo x, y;
memset(&x, 1, sizeof(x));
memset(&y, 2, sizeof(y));
x.a = y.a = x.b = y.b = 0;
atomic_compare_exchange(&x, &y, y);
All of the members of x and y are the same, so it seems like it makes
sense for the comparison to succeed. But there is (might be) a padding
byte which is 1 for x and 2 for y, causing the comparison to fail.
-E
- [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/18
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, grischka, 2021/03/19
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/19
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, grischka, 2021/03/20
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/20
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Michael Matz, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Michael Matz, 2021/03/22
Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types,
Elijah Stone <=
Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Michael Matz, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Michael Matz, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/22
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Michael Matz, 2021/03/25
- Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types, Dmitry Selyutin, 2021/03/25