mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Move remaining read functions.
Change-Id: I415edc98fa06bb8e2c1a950ebdeb42775d915a77
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
#include "ntcore.h"
|
||||
#include "nt_leb128.h"
|
||||
#include "nt_raw_istream.h"
|
||||
#include "nt_encoding.h"
|
||||
|
||||
namespace NtImpl {
|
||||
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
{
|
||||
char *buf;
|
||||
if (!Read(&buf, 1)) return false;
|
||||
*val = NtImpl::Read8(buf);
|
||||
*val = (*((unsigned char *)buf)) & 0xff;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,7 +57,9 @@ public:
|
||||
{
|
||||
char *buf;
|
||||
if (!Read(&buf, 2)) return false;
|
||||
*val = NtImpl::Read16(buf);
|
||||
unsigned int v = (*((unsigned char *)buf)) & 0xff;
|
||||
++buf; v <<= 8; v |= (*((unsigned char *)buf)) & 0xff;
|
||||
*val = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,7 +67,11 @@ public:
|
||||
{
|
||||
char *buf;
|
||||
if (!Read(&buf, 4)) return false;
|
||||
*val = NtImpl::Read32(buf);
|
||||
unsigned int v = (*((unsigned char *)buf)) & 0xff;
|
||||
++buf; v <<= 8; v |= (*((unsigned char *)buf)) & 0xff;
|
||||
++buf; v <<= 8; v |= (*((unsigned char *)buf)) & 0xff;
|
||||
++buf; v <<= 8; v |= (*((unsigned char *)buf)) & 0xff;
|
||||
*val = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user