diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/broadcom/cle/gen_pack_header.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/broadcom/cle/gen_pack_header.py b/src/broadcom/cle/gen_pack_header.py index d458c2b1c40..78ad9ad31a4 100644 --- a/src/broadcom/cle/gen_pack_header.py +++ b/src/broadcom/cle/gen_pack_header.py @@ -279,11 +279,13 @@ class Group(object): field_byte_start = (field.start // 8) * 8 start -= field_byte_start end -= field_byte_start + extra_shift = 0 if field.type == "mbo": s = "__gen_mbo(%d, %d)" % \ (start, end) elif field.type == "address": + extra_shift = (31 - (end - start)) // 8 * 8 s = "__gen_address_offset(&values->%s)" % byte.address.name elif field.type == "uint": s = "__gen_uint(values->%s, %d, %d)" % \ @@ -317,8 +319,9 @@ class Group(object): s = None if not s == None: - if byte_start - field_byte_start != 0: - s = "%s >> %d" % (s, byte_start - field_byte_start) + shift = byte_start - field_byte_start + extra_shift + if shift: + s = "%s >> %d" % (s, shift) if field == byte.fields[-1]: print("%s %s;" % (prefix, s)) |