mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
Add 0b prefixed binary numbers
This commit is contained in:
1 parent
1a63b53e13
commit
8c4c714ad1
4 files changed
+21
-8
No files matched your search
+10
-4
@@ -250,10 +250,16 @@ func appendComment(buf []byte, comments []string, line uint32, indent int, other
|
||||
|
||||
func appendNum(buf []byte, s string) []byte {
|
||||
groupLen := uint32(6)
|
||||
if (len(s) >= 2) && (s[0] == '0') && ((s[1] == 'X') || (s[1] == 'x')) {
|
||||
buf = append(buf, "0x"...)
|
||||
s = s[2:]
|
||||
groupLen = 4
|
||||
if (len(s) >= 2) && (s[0] == '0') {
|
||||
if (s[1] == 'X') || (s[1] == 'x') {
|
||||
buf = append(buf, "0x"...)
|
||||
s = s[2:]
|
||||
groupLen = 4
|
||||
} else if (s[1] == 'B') || (s[1] == 'b') {
|
||||
buf = append(buf, "0b"...)
|
||||
s = s[2:]
|
||||
groupLen = 4
|
||||
}
|
||||
}
|
||||
|
||||
nonUnderscores := uint32(0)
|
||||
|
||||
Reference in new issue
Block a user