Skip to content

Commit 3bdec8e

Browse files
committed
Add BCD util tools
1 parent ee6eec4 commit 3bdec8e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

qiling/hw/utils/bcd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ def byte2bcd(value):
1010
bcdhigh += 1
1111
value -= 10
1212

13-
return (bcdhigh << 4) | value
13+
return (bcdhigh << 4) | value
14+
15+
def bcd2byte(value):
16+
return ((value & 0xF0) >> 0x4) * 10 + (value & 0xf)

0 commit comments

Comments
 (0)