rename cast opcodes, fix for 32bit cast, fix python pretty printer (#12207)

This commit is contained in:
Arne Döring 2019-09-18 09:04:37 +02:00 • committed by GitHub
commit 638a4d9d9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 17 deletions

View file

@ -281,14 +281,27 @@ proc test_float32_cast =
let xf = cast[float32](xx)
doAssert(xf == 16.0'f32, $xf)
proc test_float32_castB() =
let a: float32 = -123.125
let b = cast[int32](a)
let c = cast[uint32](a)
doAssert b == -1024049152
doAssert cast[uint64](b) == 18446744072685502464'u64
doAssert c == 3270918144'u32
# ensure the unsused bits in the internal representation don't have
# any surprising content.
doAssert cast[uint64](c) == 3270918144'u64
test()
test_float_cast()
test_float32_cast()
free_integer_casting()
test_float32_castB()
static:
test()
test_float_cast()
test_float32_cast()
free_integer_casting()
test_float32_castB()
echo "OK"