Merge pull request #756 from water111/w/u64-float-set

[goalc] support storing a float in a 64-bit memory location
This commit is contained in:
water111
2021-08-12 20:30:27 -04:00
committed by GitHub
4 changed files with 24 additions and 1 deletions
@@ -0,0 +1,8 @@
(let ((a (new 'stack-no-clear 'array 'float 4))
(b (new 'stack-no-clear 'array 'uint64 2))
)
(set! (-> b 0) #xbbbbbbbbbbbbbbbb)
(set! (-> a 0) 12.0)
(set! (-> b 0) (the-as uint (- (-> a 0))))
(format #t "~f #x~X #x~X #x~X~%" (-> b 0) (-> b 0) (-> (the-as (pointer uint32) b) 0) (-> (the-as (pointer uint32) b) 1))
)
+5
View File
@@ -830,6 +830,11 @@ TEST_F(WithGameTests, GetEnumVals) {
"(thing5 . #<invalid object #x5>))\n0\n"});
}
TEST_F(WithGameTests, SetU64FromFloat) {
runner.run_static_test(env, testCategory, "test-set-u64-from-float.gc",
{"-12.0000 #xc1400000 #xc1400000 #x0\n0\n"});
}
TEST(TypeConsistency, TypeConsistency) {
Compiler compiler;
compiler.enable_throw_on_redefines();