Commit a00ec6d2 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Use endian.hpp for the LittleEndInt template

parent 0e1395dc
...@@ -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,22 +66,10 @@ public: ...@@ -66,22 +66,10 @@ 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) {
value = LE_INT(nval);
}
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 Byte = uint8_t; // Byte is an 8-bit unsigned integer
using Char = char; // Char is an 8-bit char using Char = char; // Char is an 8-bit char
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment