mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Avoid pointer aliasing for double/bits conversions.
Instead use the llvm MathExtras.h functions for this, which use union aliasing.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "llvm/MathExtras.h"
|
||||
#include "leb128.h"
|
||||
|
||||
using namespace nt;
|
||||
@@ -41,7 +42,7 @@ static double ReadDouble(const char*& buf) {
|
||||
val <<= 8;
|
||||
val |= (*((unsigned char*)buf)) & 0xff;
|
||||
++buf;
|
||||
return reinterpret_cast<double&>(val);
|
||||
return llvm::BitsToDouble(val);
|
||||
}
|
||||
|
||||
WireDecoder::WireDecoder(raw_istream& is, unsigned int proto_rev) : m_is(is) {
|
||||
|
||||
Reference in New Issue
Block a user