[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:
|
case ox::PrimitiveType::UnsignedInteger:
|
||||||
std::cout << fieldName << ":\tuint" << f.type->length << "_t:\t";
|
std::cout << fieldName << ":\tuint" << f.type->length << "_t:\t";
|
||||||
switch (f.type->length) {
|
switch (f.type->length) {
|
||||||
case 8: {
|
case 1: {
|
||||||
uint8_t i = {};
|
uint8_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 16: {
|
case 2: {
|
||||||
uint16_t i = {};
|
uint16_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 32: {
|
case 4: {
|
||||||
uint32_t i = {};
|
uint32_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 64: {
|
case 8: {
|
||||||
uint64_t i = {};
|
uint64_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
@ -194,25 +194,25 @@ std::map<std::string, ox::Error(*)()> tests = {
|
|||||||
case ox::PrimitiveType::SignedInteger:
|
case ox::PrimitiveType::SignedInteger:
|
||||||
std::cout << fieldName << ":\tint" << f.type->length << "_t:\t";
|
std::cout << fieldName << ":\tint" << f.type->length << "_t:\t";
|
||||||
switch (f.type->length) {
|
switch (f.type->length) {
|
||||||
case 8: {
|
case 1: {
|
||||||
int8_t i = {};
|
int8_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 16: {
|
case 2: {
|
||||||
int16_t i = {};
|
int16_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 32: {
|
case 4: {
|
||||||
int32_t i = {};
|
int32_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
std::cout << i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 64: {
|
case 8: {
|
||||||
int64_t i = {};
|
int64_t i = {};
|
||||||
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
oxAssert(rdr->op(fieldName, &i), "Walking ioOp failed.");
|
||||||
std::cout << i;
|
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) {
|
DescriptorType *TypeDescWriter::type(int8_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:int8_t";
|
constexpr auto TypeName = "B:int8_t";
|
||||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||||
constexpr auto Bytes = 8;
|
constexpr auto Bytes = 1;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(int16_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(int16_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:int16_t";
|
constexpr auto TypeName = "B:int16_t";
|
||||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||||
constexpr auto Bytes = 16;
|
constexpr auto Bytes = 2;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(int32_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(int32_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:int32_t";
|
constexpr auto TypeName = "B:int32_t";
|
||||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||||
constexpr auto Bytes = 32;
|
constexpr auto Bytes = 4;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(int64_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(int64_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:int64_t";
|
constexpr auto TypeName = "B:int64_t";
|
||||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||||
constexpr auto Bytes = 64;
|
constexpr auto Bytes = 8;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(uint8_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(uint8_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:uint8_t";
|
constexpr auto TypeName = "B:uint8_t";
|
||||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||||
constexpr auto Bytes = 8;
|
constexpr auto Bytes = 1;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(uint16_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(uint16_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:uint16_t";
|
constexpr auto TypeName = "B:uint16_t";
|
||||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||||
constexpr auto Bytes = 16;
|
constexpr auto Bytes = 2;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(uint32_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(uint32_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:uint32_t";
|
constexpr auto TypeName = "B:uint32_t";
|
||||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||||
constexpr auto Bytes = 32;
|
constexpr auto Bytes = 4;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorType *TypeDescWriter::type(uint64_t*, bool *alreadyExisted) {
|
DescriptorType *TypeDescWriter::type(uint64_t*, bool *alreadyExisted) {
|
||||||
constexpr auto TypeName = "B:uint64_t";
|
constexpr auto TypeName = "B:uint64_t";
|
||||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||||
constexpr auto Bytes = 64;
|
constexpr auto Bytes = 8;
|
||||||
return getType(TypeName, PT, Bytes, alreadyExisted);
|
return getType(TypeName, PT, Bytes, alreadyExisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user