builtin: bring back old hex()

pull/3652/head
Alexander Medvednikov 2020-02-04 20:22:50 +01:00
parent f1a0c2f1af
commit c595c9eee1
1 changed files with 4 additions and 4 deletions

View File

@ -156,16 +156,16 @@ pub fn (n i64) hex() string {
len := if n >= i64(0) { n.str().len + 3 } else { 19 } len := if n >= i64(0) { n.str().len + 3 } else { 19 }
hex := malloc(len) hex := malloc(len)
// QTODO // QTODO
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n) count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(charptr(hex), '0x%x', n) //count := C.sprintf(charptr(hex), '0x%x', n)
return tos(hex, count) return tos(hex, count)
} }
pub fn (n u64) hex() string { pub fn (n u64) hex() string {
len := if n >= u64(0) { n.str().len + 3 } else { 19 } len := if n >= u64(0) { n.str().len + 3 } else { 19 }
hex := malloc(len) hex := malloc(len)
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n) count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(charptr(hex), '0x%lx', n) //count := C.sprintf(charptr(hex), '0x%lx', n)
return tos(hex, count) return tos(hex, count)
} }