From 0a4faac56a71041dddafe350a4cf585a3325a6f5 Mon Sep 17 00:00:00 2001 From: Perry Kivolowitz Date: Thu, 21 Jul 2022 11:12:41 -0500 Subject: [PATCH] more code --- section_1/float/t.s | 16 ---------------- section_1/float/test.cpp | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 16 deletions(-) delete mode 100644 section_1/float/t.s create mode 100644 section_1/float/test.cpp diff --git a/section_1/float/t.s b/section_1/float/t.s deleted file mode 100644 index ae1b890..0000000 --- a/section_1/float/t.s +++ /dev/null @@ -1,16 +0,0 @@ - .text - .global main - .align 2 - -main: str x30, [sp, -16]! - ldr s0, =0x3fc00000 - fcvt d0, s0 - ldr x0, =fmt - bl printf - ldr x30, [sp], 16 - mov w0, wzr - ret - - .data -fmt: .asciz "%f\n" - .end diff --git a/section_1/float/test.cpp b/section_1/float/test.cpp new file mode 100644 index 0000000..466479b --- /dev/null +++ b/section_1/float/test.cpp @@ -0,0 +1,21 @@ +#include + +extern "C" uint32_t T1(double d) { + return uint32_t(d); +} + +extern "C" uint32_t T2(float f) { + return uint32_t(f); +} + +extern "C" int32_t T3(double d) { + return int32_t(d); +} + +extern "C" int32_t T4(float f) { + return int32_t(f); +} + +extern "C" uint64_t T5(double d) { + return uint64_t(d); +}