Skip to content

Commit

Permalink
Added basic support for old floats
Browse files Browse the repository at this point in the history
  • Loading branch information
Auralytical committed Jul 5, 2018
1 parent c765912 commit 8d078a5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Voltaic.Serialization.Etf/Readers/EtfReader.Float.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public static bool TryReadSingle(ref ReadOnlySpan<byte> remaining, out float res

switch (GetTokenType(ref remaining))
{
case EtfTokenType.Float:
// TODO: Untested
var bytes = remaining.Slice(1, 31);
remaining.Slice(32);
return Utf8Reader.TryReadSingle(ref bytes, out result, 'g');
case EtfTokenType.NewFloat:
{
// TODO: Untested, does Discord have any endpoints that accept floats?
Expand Down Expand Up @@ -60,6 +65,11 @@ public static bool TryReadDouble(ref ReadOnlySpan<byte> remaining, out double re

switch (GetTokenType(ref remaining))
{
case EtfTokenType.Float:
// TODO: Untested
var bytes = remaining.Slice(1, 31);
remaining.Slice(32);
return Utf8Reader.TryReadDouble(ref bytes, out result, 'g');
case EtfTokenType.NewFloat:
{
// TODO: Untested, does Discord have any endpoints that accept floats?
Expand Down

0 comments on commit 8d078a5

Please sign in to comment.