From 7b9c113d52bbcecf45c9407e4ee30ee559418cb2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Sep 2022 11:30:34 +0200 Subject: Add support for hex notation for uint64 type Specifically, now we can do: x = [uint64] 0x0000ffff cxx.poptions += "-DOFFSET=$x" # -DOFFSET=65535 cxx.poptions += "-DOFFSET=$string($x, 16)" # -DOFFSET=0xffff cxx.poptions += "-DOFFSET=$string($x, 16, 8)" # -DOFFSET=0x0000ffff Note that there is no hex notation support for the int64 (signed) type. --- tests/function/builtin/testscript | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/function/builtin/testscript b/tests/function/builtin/testscript index 00d594b..02c73ee 100644 --- a/tests/function/builtin/testscript +++ b/tests/function/builtin/testscript @@ -77,6 +77,14 @@ $* <'print $type($identity(abc))' >'' : untyped } +: string +: +{ + $* <'print $string([uint64] 0xffff)' >'65535' : uint + $* <'print $string([uint64] 0xffff, 16)' >'0xffff' : uint-hex + $* <'print $string([uint64] 0xffff, 16, 8)' >'0x0000ffff' : uint-hex-width +} + : sort : { -- cgit v1.1