aboutsummaryrefslogtreecommitdiffstats
path: root/service/src/stlfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'service/src/stlfile.c')
-rw-r--r--service/src/stlfile.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/service/src/stlfile.c b/service/src/stlfile.c
index 4dda8ee..88fc430 100644
--- a/service/src/stlfile.c
+++ b/service/src/stlfile.c
@@ -248,7 +248,7 @@ parse_file_bin(struct parseinfo *info, char *buf, size_t len)
bp += 12;
for (k = 0; k < 3; k++, bp += 12) {
for (m = 0; m < 3; m++) {
- v = le32toh(*(float *)(bp + 4 * m));
+ v = fle32toh(*(float*)(bp + 4 * m));
info->bbmin[m] = MIN(info->bbmin[m], v);
info->bbmax[m] = MAX(info->bbmax[m], v);
}
@@ -401,3 +401,15 @@ free_info(struct parseinfo *info)
NULLFREE(info->solidname);
info->valid = 0;
}
+
+float fle32toh(float v)
+{
+ union {
+ uint32_t u;
+ float f;
+ } conv;
+
+ conv.f = v;
+ conv.u = le32toh(conv.u);
+ return conv.f;
+}