summaryrefslogtreecommitdiff
path: root/chapter31/src/main/c
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-11-14 12:41:16 -0800
committerCliff Click <cliffc@acm.org>2026-11-14 12:41:16 -0800
commit3d0f3f38d9d8345b6508b3289dc94b0500c53d9e (patch)
tree1b769cdc4e415fad5c1b18afa23ffc6fe56db18a /chapter31/src/main/c
parentafcf96444366fb4b7c83f938763013cbc360aade (diff)
downloadSimple-3d0f3f38d9d8345b6508b3289dc94b0500c53d9e.tar.gz
Simple-3d0f3f38d9d8345b6508b3289dc94b0500c53d9e.zip
Breakout, Clock demos
Math lib with simple constants raw bit converters TypeConAry unified Big Formatting change Debug symbols for constant data IterPeeps was endlessly running asserts with much inlining RegAlloc rounds raised
Diffstat (limited to 'chapter31/src/main/c')
-rw-r--r--chapter31/src/main/c/simple_crt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/chapter31/src/main/c/simple_crt.c b/chapter31/src/main/c/simple_crt.c
index 438ae5f9..39708629 100644
--- a/chapter31/src/main/c/simple_crt.c
+++ b/chapter31/src/main/c/simple_crt.c
@@ -6,6 +6,19 @@
#include <termios.h>
#include <unistd.h>
+// Fixed-semantics compiler intrinsics. Keep these definitions for indirect
+// calls; direct calls may inline to representation-preserving register moves.
+int64_t simple_f64_bits(double value) {
+ int64_t bits;
+ memcpy(&bits, &value, sizeof(bits));
+ return bits;
+}
+double simple_f64_from_bits(int64_t bits) {
+ double value;
+ memcpy(&value, &bits, sizeof(value));
+ return value;
+}
+
// errno may be thread-local or a macro calling a platform accessor.
int32_t simple_errno(void) { return errno; }
int32_t simple_set_errno(int32_t error) { errno = error; return -1; }