aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-01-03 17:04:26 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-01-03 17:04:26 +0100
commitbba4563d89b6708d75a4053c69873dff0d747538 (patch)
tree8ae0c939a8b5c194f300be79e1369ad8ef4675b7 /src/util
parentceacff13a666779d75ac48f2cc5c11bc2ce5c6e1 (diff)
downloadminetest-bba4563d89b6708d75a4053c69873dff0d747538.tar.gz
minetest-bba4563d89b6708d75a4053c69873dff0d747538.tar.bz2
minetest-bba4563d89b6708d75a4053c69873dff0d747538.zip
Proselytize the network. Use IEEE F32 (#8030)
* Proselytize the network. Use IEEE F32 * Remove unused V2F1000 functions
Diffstat (limited to 'src/util')
-rw-r--r--src/util/serialize.h46
1 files changed, 19 insertions, 27 deletions
diff --git a/src/util/serialize.h b/src/util/serialize.h
index 016491a2c..5eb2b5f2e 100644
--- a/src/util/serialize.h
+++ b/src/util/serialize.h
@@ -250,29 +250,29 @@ inline v3s32 readV3S32(const u8 *data)
return p;
}
-inline v2f readV2F1000(const u8 *data)
+inline v3f readV3F1000(const u8 *data)
{
- v2f p;
- p.X = (float)readF1000(&data[0]);
- p.Y = (float)readF1000(&data[4]);
+ v3f p;
+ p.X = readF1000(&data[0]);
+ p.Y = readF1000(&data[4]);
+ p.Z = readF1000(&data[8]);
return p;
}
-inline v3f readV3F1000(const u8 *data)
+inline v2f readV2F32(const u8 *data)
{
- v3f p;
- p.X = (float)readF1000(&data[0]);
- p.Y = (float)readF1000(&data[4]);
- p.Z = (float)readF1000(&data[8]);
+ v2f p;
+ p.X = readF32(&data[0]);
+ p.Y = readF32(&data[4]);
return p;
}
inline v3f readV3F32(const u8 *data)
{
v3f p;
- p.X = (float)readF32(&data[0]);
- p.Y = (float)readF32(&data[4]);
- p.Z = (float)readF32(&data[8]);
+ p.X = readF32(&data[0]);
+ p.Y = readF32(&data[4]);
+ p.Z = readF32(&data[8]);
return p;
}
@@ -357,17 +357,17 @@ inline void writeV3S32(u8 *data, v3s32 p)
writeS32(&data[8], p.Z);
}
-inline void writeV2F1000(u8 *data, v2f p)
+inline void writeV3F1000(u8 *data, v3f p)
{
writeF1000(&data[0], p.X);
writeF1000(&data[4], p.Y);
+ writeF1000(&data[8], p.Z);
}
-inline void writeV3F1000(u8 *data, v3f p)
+inline void writeV2F32(u8 *data, v2f p)
{
- writeF1000(&data[0], p.X);
- writeF1000(&data[4], p.Y);
- writeF1000(&data[8], p.Z);
+ writeF32(&data[0], p.X);
+ writeF32(&data[4], p.Y);
}
inline void writeV3F32(u8 *data, v3f p)
@@ -411,8 +411,8 @@ MAKE_STREAM_READ_FXN(v2s16, V2S16, 4);
MAKE_STREAM_READ_FXN(v3s16, V3S16, 6);
MAKE_STREAM_READ_FXN(v2s32, V2S32, 8);
MAKE_STREAM_READ_FXN(v3s32, V3S32, 12);
-MAKE_STREAM_READ_FXN(v2f, V2F1000, 8);
MAKE_STREAM_READ_FXN(v3f, V3F1000, 12);
+MAKE_STREAM_READ_FXN(v2f, V2F32, 8);
MAKE_STREAM_READ_FXN(v3f, V3F32, 12);
MAKE_STREAM_READ_FXN(video::SColor, ARGB8, 4);
@@ -430,8 +430,8 @@ MAKE_STREAM_WRITE_FXN(v2s16, V2S16, 4);
MAKE_STREAM_WRITE_FXN(v3s16, V3S16, 6);
MAKE_STREAM_WRITE_FXN(v2s32, V2S32, 8);
MAKE_STREAM_WRITE_FXN(v3s32, V3S32, 12);
-MAKE_STREAM_WRITE_FXN(v2f, V2F1000, 8);
MAKE_STREAM_WRITE_FXN(v3f, V3F1000, 12);
+MAKE_STREAM_WRITE_FXN(v2f, V2F32, 8);
MAKE_STREAM_WRITE_FXN(v3f, V3F32, 12);
MAKE_STREAM_WRITE_FXN(video::SColor, ARGB8, 4);
@@ -527,7 +527,6 @@ public:
MAKE_BUFREADER_GETNOEX_FXN(v3s16, V3S16, 6);
MAKE_BUFREADER_GETNOEX_FXN(v2s32, V2S32, 8);
MAKE_BUFREADER_GETNOEX_FXN(v3s32, V3S32, 12);
- MAKE_BUFREADER_GETNOEX_FXN(v2f, V2F1000, 8);
MAKE_BUFREADER_GETNOEX_FXN(v3f, V3F1000, 12);
MAKE_BUFREADER_GETNOEX_FXN(video::SColor, ARGB8, 4);
@@ -549,7 +548,6 @@ public:
MAKE_BUFREADER_GET_FXN(v3s16, V3S16);
MAKE_BUFREADER_GET_FXN(v2s32, V2S32);
MAKE_BUFREADER_GET_FXN(v3s32, V3S32);
- MAKE_BUFREADER_GET_FXN(v2f, V2F1000);
MAKE_BUFREADER_GET_FXN(v3f, V3F1000);
MAKE_BUFREADER_GET_FXN(video::SColor, ARGB8);
MAKE_BUFREADER_GET_FXN(std::string, String);
@@ -663,12 +661,6 @@ inline void putV3S32(std::vector<u8> *dest, v3s32 val)
putS32(dest, val.Z);
}
-inline void putV2F1000(std::vector<u8> *dest, v2f val)
-{
- putF1000(dest, val.X);
- putF1000(dest, val.Y);
-}
-
inline void putV3F1000(std::vector<u8> *dest, v3f val)
{
putF1000(dest, val.X);