summaryrefslogtreecommitdiff
path: root/ext/fputils/fpbits.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fputils/fpbits.h')
-rw-r--r--ext/fputils/fpbits.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/fputils/fpbits.h b/ext/fputils/fpbits.h
index 335a122d3..f85a3b2f0 100644
--- a/ext/fputils/fpbits.h
+++ b/ext/fputils/fpbits.h
@@ -66,6 +66,14 @@
#define BUILD_FP64(sign, frac, exp) \
{ .bits = BUILD_IFP64(sign, frac, exp) }
+static inline fp64_t
+build_fp64(int sign, uint64_t frac, int exp)
+{
+ const fp64_t f = BUILD_FP64(sign, frac, exp);
+
+ return f;
+}
+
#define BUILD_FP80_SE(sign, exp) \
((sign) ? FP80_SIGN_BIT : 0) | \
((exp) & FP80_EXP_MASK)
@@ -80,6 +88,14 @@
.repr.fi = BUILD_FP80_FI(frac, exp) \
}
+static inline fp80_t
+build_fp80(int sign, uint64_t frac, int exp)
+{
+ const fp80_t f = BUILD_FP80(sign, frac, exp);
+
+ return f;
+}
+
#define FP80_FRAC(fp80) \
(fp80.repr.fi & FP80_FRAC_MASK)
@@ -92,4 +108,5 @@
#define FP64_EXP(fp80) \
((fp64.bits & FP64_EXP_MASK) >> FP64_EXP_SHIFT)
+
#endif