mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
freedreno/isa: add split_bits(..) methods
Will be used to split a value into needed number of 32 bit words. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11321>
This commit is contained in:
parent
1a8048954d
commit
430dc08755
1 changed files with 15 additions and 0 deletions
|
|
@ -514,3 +514,18 @@ class ISA(object):
|
|||
parts.append('v[' + str(i) + ']')
|
||||
|
||||
return ', '.join(parts)
|
||||
|
||||
def split_bits(self, value):
|
||||
''' Split `value` into a list of 32-bit integers '''
|
||||
mask, parts = (1 << 32) - 1, []
|
||||
words = self.bitsize / 32
|
||||
|
||||
while value:
|
||||
parts.append(hex(value & mask))
|
||||
value >>= 32
|
||||
|
||||
# Add 'missing' words
|
||||
while len(parts) < words:
|
||||
parts.append('0x0')
|
||||
|
||||
return parts
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue