Skip to content

Commit 8d879f2

Browse files
committed
Print '0x' prefix for bytes
1 parent 19993ba commit 8d879f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/common/bytearray.effekt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ def toHexCharBytes(b: Byte): Unit / emit[Byte] = {
150150
do emit(low.toHexDigit)
151151
}
152152

153-
/// Converts a byte like `0xAB` into a bytearray `bytearray.['A', 'B']"`
154-
/// _without a `0x`_ prefix
153+
/// Converts a byte like `0xAB` into a bytearray `bytearray.['0', 'x', 'A', 'B']"`
155154
def toHexCharBytes(b: Byte): ByteArray = collect {
155+
do emit(0x30) // '0'
156+
do emit(0x78) // 'x'
156157
b.toHexCharBytes
157158
}
158159

0 commit comments

Comments
 (0)