cschramm / irda

36 stars 8 forks source link

fix #14: when using test_and_set_bit(), target must be volatile unsigned long #15

Closed dpiegdon closed 5 months ago

dpiegdon commented 5 months ago

when using (int) instead, this may work on 32-bit platforms, (sizeof int == 4 == sizeof unsigned long), but will lead to memory corruption on 64-bit platforms (sizeof(int)==4, sizeof(long==8)). luckily the alignment error made this issue visible. it would be better to use appropriate locking types for this, though.

This fixes #14.