Move remaining read functions.

Change-Id: I415edc98fa06bb8e2c1a950ebdeb42775d915a77
This commit is contained in:
Peter Johnson
2015-06-21 22:07:29 -07:00
parent b88a9295bf
commit dbed3fea6f
2 changed files with 9 additions and 32 deletions

View File

@@ -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;
}