summaryrefslogtreecommitdiff
path: root/src/scripts/fix.5c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/fix.5c')
-rw-r--r--src/scripts/fix.5c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/scripts/fix.5c b/src/scripts/fix.5c
new file mode 100644
index 00000000..b758a433
--- /dev/null
+++ b/src/scripts/fix.5c
@@ -0,0 +1,14 @@
+/*
+ * Convert CSC fix point values to floats
+ */
+
+real fixval (int fix)
+{
+ int exp = fix >> 9;
+ int mant = fix & ((1 << 9) - 1);
+ real ret;
+ if (exp == 0x7)
+ return 1.0;
+ ret = (2 ** -exp) * mant / (1 << 9);
+ return ret;
+}