Skip to content

Commit

Permalink
fix value zero (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j committed Jun 26, 2023
1 parent 7481507 commit 83f701a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/opir.nim
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ proc genMacroDecl(macroDef: CXCursor): JsonNode =
of 'x', 'X': parseReturn(HexInt, def.replace("'", ""), kind)
of 'b', 'B': parseReturn(BinInt, def.replace("'", ""), kind)
of '1'..'9': parseReturn(OctInt, def[1..^1].replace("'", ""), kind)
of 'u', 'U', 'l', 'L', 'z', 'Z': parseReturn(BiggestInt, def, kind)
else: discard
of '-': parseReturn(BiggestInt, def.replace("'", ""), kind)
of '1'..'9': parseReturn(BiggestInt, def.replace("'", ""), kind); parseReturn(BiggestUInt, def.replace("'", ""), kind)
Expand Down
1 change: 1 addition & 0 deletions tests/tstdint.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Adapted from usage in the wild:
// https://github.com/boschsensortec/BME68x-Sensor-API/blob/master/bme68x_defs.h

#define TEST_UINT8_ZERO UINT8_C(0)
#define TEST_UINT8 UINT8_C(0xff)
#define TEST_UINT16 UINT16_C(0xffff)
#define TEST_UINT32 UINT32_C(0xffffffff)
Expand Down
1 change: 1 addition & 0 deletions tests/tstdint.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ importc:
path "."
"tstdint.h"

doAssert TEST_UINT8_ZERO == 0'u8.uint8
doAssert TEST_UINT8 == 0xff'u8.uint8
doAssert TEST_UINT16 == 0xffff'u16.cuint
doAssert TEST_UINT32 == 0xffffffff'u32.culong
Expand Down

0 comments on commit 83f701a

Please sign in to comment.