Skip to content

Commit

Permalink
Merge pull request #36 from RevolveNTNU/uint8_t-fixes
Browse files Browse the repository at this point in the history
Changed to everything we do not account for is 32
  • Loading branch information
AliceMadama authored May 21, 2024
2 parents 4d3e53e + b8538a7 commit d22b9eb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions RevolveUavcan/Tools/BitArrayTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,15 @@ public static BitArray GetBitArrayFromDouble(double value, int size)
if (size == 64)
{
bytes = BitConverter.GetBytes(value);
}
else if (size == 32)
{
bytes = BitConverter.GetBytes((float)value);

}
else if (size == 16)
{
bytes = BitConverter.GetBytes((Half)value);
}
else
{
throw new ArgumentException("Unsupported bit length; must be 16, 32, or 64 bits.");
bytes = BitConverter.GetBytes((float)value);
}

if (!BitConverter.IsLittleEndian)
Expand Down

0 comments on commit d22b9eb

Please sign in to comment.