digitalmars.D.learn - Atomic bit operations
- Crayo List (3/3) Dec 10 2018 Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc
- Adam D. Ruppe (3/5) Dec 10 2018 Those are intrinsics that compile into a single cpu instruction,
- Crayo List (9/14) Dec 10 2018 Thanks Adam,
Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc from core.bitop? Thanks
Dec 10 2018
On Monday, 10 December 2018 at 23:20:22 UTC, Crayo List wrote:Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc from core.bitop?Those are intrinsics that compile into a single cpu instruction, so they are probably already atomic...
Dec 10 2018
On Tuesday, 11 December 2018 at 01:37:25 UTC, Adam D. Ruppe wrote:On Monday, 10 December 2018 at 23:20:22 UTC, Crayo List wrote:Thanks Adam, They need to be prefixed with 'lock' (on x86) in order to be atomic. That's what _interlockedbittestandset() on Windows does. And what this page says; https://www.felixcloutier.com/x86/LOCK.html It may be possible to implement using asm { }, but I was wondering if there wasn't something out there already doing it.Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc from core.bitop?Those are intrinsics that compile into a single cpu instruction, so they are probably already atomic...
Dec 10 2018