misc: Run pre-commit run on all files in repo
The following command was run: ``` pre-commit run --all-files ``` This ensures all the files in the repository are formatted to pass our checks. Change-Id: Ia2fe3529a50ad925d1076a612d60a4280adc40de Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62572 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
committed by
Bobby Bruce
parent
64add0e04d
commit
2bc5a8b71a
@@ -26,16 +26,17 @@
|
||||
import array
|
||||
import functools
|
||||
|
||||
|
||||
def bytesToCppArray(code, symbol, data):
|
||||
'''
|
||||
"""
|
||||
Output an array of bytes to a code formatter as a c++ array declaration.
|
||||
'''
|
||||
code('const std::uint8_t ${symbol}[] = {')
|
||||
"""
|
||||
code("const std::uint8_t ${symbol}[] = {")
|
||||
code.indent()
|
||||
step = 16
|
||||
for i in range(0, len(data), step):
|
||||
x = array.array('B', data[i:i+step])
|
||||
strs = map(lambda i: f'{i},', x)
|
||||
x = array.array("B", data[i : i + step])
|
||||
strs = map(lambda i: f"{i},", x)
|
||||
code(functools.reduce(lambda x, y: x + y, strs))
|
||||
code.dedent()
|
||||
code('};')
|
||||
code("};")
|
||||
|
||||
Reference in New Issue
Block a user