VarHandles on non-int-sized fields and atomic operations
Martin Buchholz
martinrb at google.com
Mon May 23 22:16:55 UTC 2016
On Mon, May 23, 2016 at 1:16 PM, Martin Buchholz <martinrb at google.com> wrote:
> So it is likely that
> atomic<short>
> will be stored in a 32-bit field, since the cpu is likely to have a
> 32-bit cas, but not 16-bit cas.
So apparently you can still store your atomic<short> in 16 bits, by
implementing strong CAS and atomic assignment using read+mask+cas on
enclosing 32 bits in a loop. But if you knew ahead of time that your
short was going to be atomic, you might want to give it those extra 16
bits anyways?
More information about the core-libs-dev
mailing list