diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-05-23 19:00:18 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-05-23 19:00:18 +0200 |
| commit | ddf5c236446767b60718b7254a4e4d3c5e4c941c (patch) | |
| tree | 92a5d4aa322547c54dc5f06d5a78b2a8bb765695 /service/src/stlfile.c | |
| parent | f75abdd928302e8ef555e1f10b19b6105609775e (diff) | |
| download | enowars5-service-stldoctor-ddf5c236446767b60718b7254a4e4d3c5e4c941c.tar.gz enowars5-service-stldoctor-ddf5c236446767b60718b7254a4e4d3c5e4c941c.zip | |
added test command for upload custom file, various smaller changes, fixed float little-endian loading
Diffstat (limited to 'service/src/stlfile.c')
| -rw-r--r-- | service/src/stlfile.c | 14 |
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; +} |
