|
|
|
|
|
by dpc_pw
4016 days ago
|
|
This post is literally about saving one byte, at the cost of being slower and not producer-consumer friendly. Not very interesting. The flag could have been hidden in any other field as a bit or something. Then it could be at least masked with simple AND operation which is usually faster than branching, especially on pipelined CPUs. Update: Quick implementation: https://gist.github.com/dpc/a194b7784adfa150a450 This fix for concurrency issue is an ugly hack. I'm not sure if it's even correct in this particular scenario, and definitely not proper for anything that would aspire to be good reusable code. I'd advise this code to push atomicity requirement onto caller. Irqs should have been disabled by calling code. "register" keyword is obsolete. There's no point in using it. |
|