summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2018-05-02 14:48:57 -0700
committerLionel Landwerlin <[email protected]>2018-05-04 23:58:10 +0100
commit9d1ff2261ccec49994c8162c20969b693b29639a (patch)
tree3791b20456acfed71a53707c5a737bc2aef2f3ac
parent9a10a2fd5fc11ee08e8fa049f59fd129885cd332 (diff)
intel/genxml: recognize 0x, 0o and 0b when setting default value
Remove the need of converting values that are documented in hexadecimal. This patch would allow writing <field name="3D Command Sub Opcode" ... default="0x1B"/> instead of <field name="3D Command Sub Opcode" ... default="27"/> Reviewed-by: Lionel Landwerlin <[email protected]>
-rw-r--r--src/intel/genxml/gen_pack_header.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py
index 8989f625d31..6a4c8033a70 100644
--- a/src/intel/genxml/gen_pack_header.py
+++ b/src/intel/genxml/gen_pack_header.py
@@ -241,7 +241,8 @@ class Field(object):
self.prefix = None
if "default" in attrs:
- self.default = int(attrs["default"])
+ # Base 0 recognizes 0x, 0o, 0b prefixes in addition to decimal ints.
+ self.default = int(attrs["default"], base=0)
else:
self.default = None