summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-29 14:33:31 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-29 14:33:31 +0200
commit06efb4b30dd806867ffe5d21f41482a5f52e6349 (patch)
tree1c0e3d42d5d95521d781841dec6e9b2e6c115319
parentde89c6d5a9a0ae4b8dac5ae8ad3c77440f40f0e3 (diff)
downloadxdd2esi-06efb4b30dd806867ffe5d21f41482a5f52e6349.tar.gz
xdd2esi-06efb4b30dd806867ffe5d21f41482a5f52e6349.zip
Set the unit of 'Number of entries' (subindex 0) always to integer
-rw-r--r--xddlib.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/xddlib.py b/xddlib.py
index 8c9b485..17f78f6 100644
--- a/xddlib.py
+++ b/xddlib.py
@@ -312,6 +312,9 @@ def _convert_cast_get_unit(obj, unit, value):
if unit == 'dt': # If the unit is 'dt', get the real unit from the
# datatype
newunit = obj.datatype.type_
+ # "Number of entries" should always be an int
+ if obj.parent is not None and int(obj.subindex, 16) == 0:
+ newunit = 'integer'
# The datatype doesn't know hexint, but if an integer starts with '0x'
# it's hexadecimal.
if (newunit == 'integer') and value.startswith('0x'):