mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-23 23:46:48 +08:00
more code
This commit is contained in:
parent
1e325fa7d8
commit
0a4faac56a
2 changed files with 21 additions and 16 deletions
|
|
@ -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
|
|
||||||
21
section_1/float/test.cpp
Normal file
21
section_1/float/test.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue