aboutsummaryrefslogtreecommitdiffhomepage
path: root/endian.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-29 09:59:30 +0200
committerlemon <lsof@mailbox.org>2023-06-29 09:59:30 +0200
commitf453b313f62ba42d748f00628be7b3750c797c86 (patch)
treee654029d425dee2adf30c0fa2adba31d0266db1c /endian.h
parent3b96204593b9812674126bad8de14419009682c8 (diff)
add initializers (only static for initialier list rn)
and other fixes
Diffstat (limited to 'endian.h')
-rw-r--r--endian.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/endian.h b/endian.h
index 8448c79..e1e9740 100644
--- a/endian.h
+++ b/endian.h
@@ -128,6 +128,20 @@ wr64targ(uchar *p, uvlong x)
memcpy(p, &x, sizeof x);
}
+static inline void
+wrf32targ(uchar *p, float x)
+{
+ union { float f; uint i; } u = { x };
+ wr32targ(p, u.i);
+}
+
+static inline void
+wrf64targ(uchar *p, double x)
+{
+ union { double f; uvlong i; } u = { x };
+ wr64targ(p, u.i);
+}
+
#endif /* ENDIAN_H_ */
/* vim:set ts=3 sw=3 expandtab: */