mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 02:30:11 +00:00
[spinel] fix little endian in lib (#10522)
This commit is contained in:
@@ -464,12 +464,12 @@ private:
|
||||
public:
|
||||
static uint16_t ReadUint16(const uint8_t *aBuffer)
|
||||
{
|
||||
return static_cast<uint16_t>((aBuffer[0] << 8) | aBuffer[1]);
|
||||
return static_cast<uint16_t>((aBuffer[0]) | aBuffer[1] << 8);
|
||||
}
|
||||
static void WriteUint16(uint16_t aValue, uint8_t *aBuffer)
|
||||
{
|
||||
aBuffer[0] = (aValue >> 8) & 0xff;
|
||||
aBuffer[1] = (aValue >> 0) & 0xff;
|
||||
aBuffer[0] = (aValue >> 0) & 0xff;
|
||||
aBuffer[1] = (aValue >> 8) & 0xff;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -238,12 +238,12 @@ private:
|
||||
public:
|
||||
static uint16_t ReadUint16(const uint8_t *aBuffer)
|
||||
{
|
||||
return static_cast<uint16_t>((aBuffer[0] << 8) | aBuffer[1]);
|
||||
return static_cast<uint16_t>((aBuffer[0]) | aBuffer[1] << 8);
|
||||
}
|
||||
static void WriteUint16(uint16_t aValue, uint8_t *aBuffer)
|
||||
{
|
||||
aBuffer[0] = (aValue >> 8) & 0xff;
|
||||
aBuffer[1] = (aValue >> 0) & 0xff;
|
||||
aBuffer[0] = (aValue >> 0) & 0xff;
|
||||
aBuffer[1] = (aValue >> 8) & 0xff;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user