Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
a00ec6d2
Commit
a00ec6d2
authored
Mar 12, 2022
by
Rob Swindell
💬
Browse files
Use endian.hpp for the LittleEndInt template
parent
0e1395dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
19 deletions
+7
-19
src/encode/pascal_types.hpp
src/encode/pascal_types.hpp
+7
-19
No files found.
src/encode/pascal_types.hpp
View file @
a00ec6d2
...
@@ -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 "
xp
endian.h"
#include "endian.h
pp
"
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment