Skip to content

Commit

Permalink
Format signed values as decimal.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Dec 26, 2018
1 parent 2a847ed commit 106ec68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions generator/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def generate_type(self, abi, type):
or isinstance(type, OpaqueType)):
if len(type.values) == 1 and type.values[0].value == 0:
val_format = 'd'
elif type.int_type.name[0] == 'i': # Signed
val_format = 'd'
else:
val_format = '#0{}x'.format(type.layout.size[0] * 2 +
2)
Expand Down
2 changes: 2 additions & 0 deletions generator/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def generate_type(self, abi, type):
or isinstance(type, OpaqueType)):
if len(type.values) == 1 and type.values[0].value == 0:
val_format = 'd'
elif type.int_type.name[0] == 'i': # Signed
val_format = 'd'
else:
val_format = '#0{}x'.format(type.layout.size[0] * 2 +
2)
Expand Down

0 comments on commit 106ec68

Please sign in to comment.