From f453b313f62ba42d748f00628be7b3750c797c86 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 29 Jun 2023 09:59:30 +0200 Subject: add initializers (only static for initialier list rn) and other fixes --- endian.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'endian.h') 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: */ -- cgit v1.2.3