lynn/chibicc

Support unsigned integers

Closed this issue · 0 comments

Background: #9.

The main motivation is providing a performance boost, especially for right shifts and division, but the simpler zero-extension and comparison are nice too. Also, 0xFFFFu would be allowed, whereas currently the tokeniser rejects 0xFFFF, though maybe it shouldn't to begin with. The README should explain when using unsigned integers is beneficial, and how to use them, nothing that e.g. unsigned char stuff is normally promoted to signed int IIRC.

These are easy to do codegen for, we basically just use the code from before the signedness fixes. The tricky thing is the type system changes. We'll want to implement the “usual arithmetic conversions” and “integer promotions” correctly. Maybe modern chibicc's implementation will be helpful?