Add float16 sending support
This commit is contained in:
parent
89453f621c
commit
3606cb642a
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -2,3 +2,6 @@
|
|||||||
path = LinearAlgebra
|
path = LinearAlgebra
|
||||||
url = ../linear-algebra.git
|
url = ../linear-algebra.git
|
||||||
brnach = main
|
brnach = main
|
||||||
|
[submodule "float16"]
|
||||||
|
path = float16
|
||||||
|
url = http://gitlab.passervr.com/passer/cpp/float16.git
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "LinearAlgebra/Angle8.h"
|
#include "LinearAlgebra/Angle8.h"
|
||||||
#include "LinearAlgebra/Spherical.h"
|
#include "LinearAlgebra/Spherical.h"
|
||||||
|
#include "float16/float16.h"
|
||||||
|
|
||||||
NetworkSync::NetworkSync(Roboid *roboid) { this->roboid = roboid; }
|
NetworkSync::NetworkSync(Roboid *roboid) { this->roboid = roboid; }
|
||||||
|
|
||||||
@ -158,6 +159,14 @@ void NetworkSync::SendSingle100(unsigned char *data, unsigned int startIndex,
|
|||||||
// data[startIndex + ix] = ((unsigned char *)&intValue)[ix];
|
// data[startIndex + ix] = ((unsigned char *)&intValue)[ix];
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
void NetworkSync::SendFloat16(unsigned char *data, unsigned char *startIndex,
|
||||||
|
float value) {
|
||||||
|
float16 value16 = float16(value);
|
||||||
|
short binary = value16.getBinary();
|
||||||
|
|
||||||
|
data[(*startIndex)++] = (binary >> 8) & 0x0F;
|
||||||
|
data[(*startIndex)++] = binary & 0x0F;
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkSync::SendInt32(unsigned char *data, unsigned int startIndex,
|
void NetworkSync::SendInt32(unsigned char *data, unsigned int startIndex,
|
||||||
Int32 value) {
|
Int32 value) {
|
||||||
|
@ -76,6 +76,8 @@ protected:
|
|||||||
InterestingThing *object);
|
InterestingThing *object);
|
||||||
|
|
||||||
void SendSingle100(unsigned char *data, unsigned int startIndex, float value);
|
void SendSingle100(unsigned char *data, unsigned int startIndex, float value);
|
||||||
|
void SendFloat16(unsigned char *data, unsigned char *startIndex, float value);
|
||||||
|
|
||||||
void SendInt32(unsigned char *data, unsigned int startIndex, Int32 value);
|
void SendInt32(unsigned char *data, unsigned int startIndex, Int32 value);
|
||||||
void SendAngle8(unsigned char *data, unsigned int startIndex,
|
void SendAngle8(unsigned char *data, unsigned int startIndex,
|
||||||
const float value);
|
const float value);
|
||||||
|
1
float16
Submodule
1
float16
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 51cffc3ae3da69212ef290a7ad6ed1c747ffa6ab
|
Loading…
x
Reference in New Issue
Block a user