Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I found that after I had already written a lot of that code. I haven't had much reason to go back and change it, but any PR's if someone wants to do it, would be accepted.


What about simply replacing all "== 0b..." with "!= 0"?

That would already be a good improvement, both in terms of DRY and readability, without the need of adding another dependency.


It wouldn't be the same thing. For instance x & 0b11 != 0 can return true for multiple values of x, 0b10 and 0b01 respectively.


I see. You are sometimes checking for multiple bits at once. Didn't notice that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: