Skip to content
Snippets Groups Projects
Commit a00ec6d2 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use endian.hpp for the LittleEndInt template

parent 0e1395dc
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <algorithm> // std::min #include <algorithm> // std::min
#include <type_traits> #include <type_traits>
#include "gen_defs.h" #include "gen_defs.h"
#include "xpendian.h" #include "endian.hpp"
namespace Pascal { namespace Pascal {
...@@ -66,23 +66,11 @@ public: ...@@ -66,23 +66,11 @@ public:
// All multi-byte integer data types are all implicitly little-endian (x86), // All multi-byte integer data types are all implicitly little-endian (x86),
// so provide automatic byte-swap (on big-endian systems) during assignment operations. // so provide automatic byte-swap (on big-endian systems) during assignment operations.
template <typename T> using Integer = LittleEndInt<int16_t>; // Integer is a 16-bit signed integer
class LittleEndianInteger { using Word = LittleEndInt<uint16_t>; // Word is a 16-bit unsigned integer
T value{}; using LongInt = LittleEndInt<int32_t>; // LongInt is a 32-bit signed integer
public: using LongWord = LittleEndInt<uint32_t>; // LongWord is a 32-bit unsigned integer
void operator = (T nval) { using Byte = uint8_t; // Byte is an 8-bit unsigned integer
value = LE_INT(nval); using Char = char; // Char is an 8-bit char
}
T operator = (const LittleEndianInteger&) {
return LE_INT(value);
}
};
using Integer = LittleEndianInteger<int16_t>; // Integer is a 16-bit signed integer
using Word = LittleEndianInteger<uint16_t>; // Word is a 16-bit unsigned integer
using LongInt = LittleEndianInteger<int32_t>; // LongInt is a 32-bit signed integer
using LongWord = LittleEndianInteger<uint32_t>; // LongWord is a 32-bit unsigned integer
using Byte = uint8_t; // Byte is an 8-bit unsigned integer
using Char = char; // Char is an 8-bit char
} // namespace Pascal } // namespace Pascal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment