[ox/ser] Fix byte lengths of integer types
This commit is contained in:
parent
e45122184e
commit
4330c015a5
16
deps/ox/src/ox/mc/test/tests.cpp
vendored
16
deps/ox/src/ox/mc/test/tests.cpp
vendored
@ -164,25 +164,25 @@ std::map<std::string, ox::Error(*)()> 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<std::string, ox::Error(*)()> 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;
|
||||
|
16
deps/ox/src/ox/ser/descwrite.cpp
vendored
16
deps/ox/src/ox/ser/descwrite.cpp
vendored
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user