[PATCH] D158288: [LangRef] Document integer hexadecimal constants

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 09:54:43 PDT 2023


luke added a comment.

In D158288#4599255 <https://reviews.llvm.org/D158288#4599255>, @arsenm wrote:

> Thanks, I’ve known this existed but couldn’t ever remember the syntax. Can you add some more examples?

After playing about a bit, I'm actually a bit surprised by how signed hex constants behave <https://godbolt.org/z/jq1eGoK4o>. 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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158288/new/

https://reviews.llvm.org/D158288



More information about the llvm-commits mailing list