diff options
author | Vlad Golovkin <[email protected]> | 2018-04-19 23:08:01 +0300 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-04-24 09:55:05 +1000 |
commit | 1ff1dc1c631b97430b46dc84f5806e13ea4c524f (patch) | |
tree | d6e3b43a24b4a29d6528731a9e8399de70a1b482 /bin | |
parent | 295f57e09a8b67da07dd96609591dc5144031a62 (diff) |
glsl/glcpp: Handle hex constants with 0X prefix
GLSL 4.6 spec describes hex constant as:
hexadecimal-constant:
0x hexadecimal-digit
0X hexadecimal-digit
hexadecimal-constant hexadecimal-digit
Right now if you have a shader with the following structure:
#if 0X1 // or any hex number with the 0X prefix
// some code
#endif
the code between #if and #endif gets removed because the checking is performed
only for "0x" prefix which results in strtoll being called with the base 8 and
after encountering the 'X' char the strtoll returns 0. Letting strtoll detect
the base makes this limitation go away and also makes code easier to read.
From the strtoll Linux man page:
"If base is zero or 16, the string may then include a "0x" prefix, and the
number will be read in base 16; otherwise, a zero base is taken as 10 (decimal)
unless the next character is '0', in which case it is taken as 8 (octal)."
This matches the behaviour in the GLSL spec.
This patch also adds a test for uppercase hex prefix.
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'bin')
0 files changed, 0 insertions, 0 deletions