summaryrefslogtreecommitdiff
path: root/src/common/endianness.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-19 13:02:54 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-19 13:02:54 (GMT)
commit94fd405bb0c2e6dfa43324b04a336ffb611c58ce (patch)
treef3170587b4006fa358665a6bbfa301731503d3b3 /src/common/endianness.h
parent499f00977cd7f50ce0c4cf24dd59b1e920e5b180 (diff)
Provided initial features for debugging using GDB.
Diffstat (limited to 'src/common/endianness.h')
-rwxr-xr-xsrc/common/endianness.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/common/endianness.h b/src/common/endianness.h
index 2af6493..5ceb2ee 100755
--- a/src/common/endianness.h
+++ b/src/common/endianness.h
@@ -43,6 +43,33 @@ typedef enum _SourceEndian
} SourceEndian;
+/* --------------------------- CONVERSION ENTRE BOUTISMES --------------------------- */
+
+
+/* Adapte un nombre sur 16 bits à un boutisme donné. */
+uint16_t swap_u16(const uint16_t *, SourceEndian);
+
+/* Adapte un nombre sur 16 bits à un boutisme donné. */
+uint32_t swap_u32(const uint32_t *, SourceEndian);
+
+/* Adapte un nombre sur 16 bits à un boutisme donné. */
+uint64_t swap_u64(const uint64_t *, SourceEndian);
+
+
+#define from_u16(v, e) swap_u16(v, e)
+#define from_u32(v, e) swap_u32(v, e)
+#define from_u64(v, e) swap_u64(v, e)
+
+
+#define to_u16(v, e) swap_u16(v, e)
+#define to_u32(v, e) swap_u32(v, e)
+#define to_u64(v, e) swap_u64(v, e)
+
+
+
+/* ------------------------- BOUTISME DES ENTREES / SORTIES ------------------------- */
+
+
/* Lit un nombre non signé sur 4 bits. */
bool read_u4(uint8_t *, const bin_t *, phys_t *, phys_t, bool *);