3 ms·
extern volatile uint64_t *reg; *reg &= ~x; People should stop doing this. What this means is: extern volatile uint64_t *reg; uint64_t tmp = *reg; tmp
by tialaramex 4y ago
extern volatile uint64_t *reg;
*reg &= ~x;
People should stop doing this. What this means is:
extern volatile uint64_t *reg;
uint64_t tmp = *reg;
tmp &= ~x;
*reg = temp;
But of course when you write that chances are somebody will point out that you're running in interruptible context sometimes in this function, so that's actually introducing a race condition. Why didn't they say so when you wrote it your way? Because that looked like a single operation and so it wasn't obvious it might get interrupted.