It's possible to write an integer constant in hexadecimal, but you need to
prefix it with u or s. I couldn't find this mentioned anywhere in the LangRef,
so this adds a small note about it.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks, I’ve known this existed but couldn’t ever remember the syntax. Can you add some more examples?
Comment Actions
After playing about a bit, I'm actually a bit surprised by how signed hex constants behave. They're sign extended from the number of active bits, so it's not actually possible to represent a positive signed constant. I've traced it back to this commit from 2007: https://github.com/llvm/llvm-project/commit/7957de7949d7f45d0adc81dde38ae0468f1cd09d
I've documented it anyway.