projects
/
oota-llvm.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Cleanup coff-dump.py
[oota-llvm.git]
/
test
/
Scripts
/
common_dump.py
1
def dataToHex(d):
2
""" Convert the raw data in 'd' to an hex string with a space every 4 bytes.
3
"""
4
bytes = []
5
for i,c in enumerate(d):
6
byte = ord(c)
7
hex_byte = hex(byte)[2:]
8
if byte <= 0xf:
9
hex_byte = '0' + hex_byte
10
if i % 4 == 3:
11
hex_byte += ' '
12
bytes.append(hex_byte)
13
return ''.join(bytes).strip()