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 <lionel.g.landwerlin@intel.com>
This commit is contained in:
Caio Marcelo de Oliveira Filho 2018-05-02 14:48:57 -07:00 committed by Lionel Landwerlin
parent 9a10a2fd5f
commit 9d1ff2261c

View file

@ -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