builtin: voidptr.str() and byteptr.str()
parent
d75f286230
commit
a72f3ed0c7
|
@ -345,6 +345,14 @@ pub fn (nn i64) hex() string {
|
||||||
return u64(nn).hex()
|
return u64(nn).hex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn (nn voidptr) str() string {
|
||||||
|
return u64(nn).hex()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn (nn byteptr) str() string {
|
||||||
|
return u64(nn).hex()
|
||||||
|
}
|
||||||
|
|
||||||
// ----- utilities functions -----
|
// ----- utilities functions -----
|
||||||
|
|
||||||
pub fn (a []byte) contains(val byte) bool {
|
pub fn (a []byte) contains(val byte) bool {
|
||||||
|
|
|
@ -71,6 +71,10 @@ fn test_str_methods() {
|
||||||
assert u32(-1).str() == '4294967295'
|
assert u32(-1).str() == '4294967295'
|
||||||
assert u64(1).str() == '1'
|
assert u64(1).str() == '1'
|
||||||
assert u64(-1).str() == '18446744073709551615'
|
assert u64(-1).str() == '18446744073709551615'
|
||||||
|
assert voidptr(-1).str() == 'ffffffffffffffff'
|
||||||
|
assert voidptr(1).str() == '1'
|
||||||
|
assert byteptr(-1).str() == 'ffffffffffffffff'
|
||||||
|
assert byteptr(1).str() == '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_and_precendence() {
|
fn test_and_precendence() {
|
||||||
|
|
Loading…
Reference in New Issue