Added 64-bit networking support

Mainly for use with doubles as ZScript can now take advantage of it. Enforced sizing on ints passed to and read from net functions.
This commit is contained in:
Boondorl 2024-01-05 15:08:49 -05:00 committed by Christoph Oelckers
commit df9b2cd9bf
7 changed files with 243 additions and 63 deletions

View file

@ -259,7 +259,7 @@ static struct TicSpecial
streamoffs = 0;
}
TicSpecial &operator << (uint8_t it)
TicSpecial &operator << (int8_t it)
{
if (streamptr)
{
@ -269,7 +269,7 @@ static struct TicSpecial
return *this;
}
TicSpecial &operator << (short it)
TicSpecial &operator << (int16_t it)
{
if (streamptr)
{
@ -279,7 +279,7 @@ static struct TicSpecial
return *this;
}
TicSpecial &operator << (int it)
TicSpecial &operator << (int32_t it)
{
if (streamptr)
{
@ -289,6 +289,16 @@ static struct TicSpecial
return *this;
}
TicSpecial& operator << (int64_t it)
{
if (streamptr)
{
CheckSpace(8);
WriteInt64(it, &streamptr);
}
return *this;
}
TicSpecial &operator << (float it)
{
if (streamptr)
@ -299,6 +309,16 @@ static struct TicSpecial
return *this;
}
TicSpecial& operator << (double it)
{
if (streamptr)
{
CheckSpace(8);
WriteDouble(it, &streamptr);
}
return *this;
}
TicSpecial &operator << (const char *it)
{
if (streamptr)
@ -2047,17 +2067,22 @@ void Net_NewMakeTic (void)
specials.NewMakeTic ();
}
void Net_WriteInt8 (uint8_t it)
void Net_WriteInt8 (int8_t it)
{
specials << it;
}
void Net_WriteInt16 (short it)
void Net_WriteInt16 (int16_t it)
{
specials << it;
}
void Net_WriteInt32 (int it)
void Net_WriteInt32 (int32_t it)
{
specials << it;
}
void Net_WriteInt64(int64_t it)
{
specials << it;
}
@ -2067,6 +2092,11 @@ void Net_WriteFloat (float it)
specials << it;
}
void Net_WriteDouble(double it)
{
specials << it;
}
void Net_WriteString (const char *it)
{
specials << it;