From 4330c015a5010be4115ad802170715693f12a6c8 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 8 Mar 2019 00:21:33 -0600 Subject: [PATCH] [ox/ser] Fix byte lengths of integer types --- deps/ox/src/ox/mc/test/tests.cpp | 16 ++++++++-------- deps/ox/src/ox/ser/descwrite.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/deps/ox/src/ox/mc/test/tests.cpp b/deps/ox/src/ox/mc/test/tests.cpp index 9e18e22b..631c24dc 100644 --- a/deps/ox/src/ox/mc/test/tests.cpp +++ b/deps/ox/src/ox/mc/test/tests.cpp @@ -164,25 +164,25 @@ std::map tests = { case ox::PrimitiveType::UnsignedInteger: std::cout << fieldName << ":\tuint" << f.type->length << "_t:\t"; switch (f.type->length) { - case 8: { + case 1: { uint8_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; break; } - case 16: { + case 2: { uint16_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; break; } - case 32: { + case 4: { uint32_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; break; } - case 64: { + case 8: { uint64_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; @@ -194,25 +194,25 @@ std::map tests = { case ox::PrimitiveType::SignedInteger: std::cout << fieldName << ":\tint" << f.type->length << "_t:\t"; switch (f.type->length) { - case 8: { + case 1: { int8_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; break; } - case 16: { + case 2: { int16_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; break; } - case 32: { + case 4: { int32_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; break; } - case 64: { + case 8: { int64_t i = {}; oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed."); std::cout << i; diff --git a/deps/ox/src/ox/ser/descwrite.cpp b/deps/ox/src/ox/ser/descwrite.cpp index b470cfe0..56a90e9f 100644 --- a/deps/ox/src/ox/ser/descwrite.cpp +++ b/deps/ox/src/ox/ser/descwrite.cpp @@ -49,56 +49,56 @@ TypeDescWriter::~TypeDescWriter() { DescriptorType *TypeDescWriter::type(int8_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:int8_t"; constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 8; + constexpr auto Bytes = 1; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(int16_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:int16_t"; constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 16; + constexpr auto Bytes = 2; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(int32_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:int32_t"; constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 32; + constexpr auto Bytes = 4; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(int64_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:int64_t"; constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 64; + constexpr auto Bytes = 8; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(uint8_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:uint8_t"; constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 8; + constexpr auto Bytes = 1; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(uint16_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:uint16_t"; constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 16; + constexpr auto Bytes = 2; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(uint32_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:uint32_t"; constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 32; + constexpr auto Bytes = 4; return getType(TypeName, PT, Bytes, alreadyExisted); } DescriptorType *TypeDescWriter::type(uint64_t*, bool *alreadyExisted) { constexpr auto TypeName = "B:uint64_t"; constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 64; + constexpr auto Bytes = 8; return getType(TypeName, PT, Bytes, alreadyExisted); }