summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/utils/hexa.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/utils/hexa.cc')
-rw-r--r--2004/i/nono/src/utils/hexa.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/2004/i/nono/src/utils/hexa.cc b/2004/i/nono/src/utils/hexa.cc
index 247b44c..ab43f64 100644
--- a/2004/i/nono/src/utils/hexa.cc
+++ b/2004/i/nono/src/utils/hexa.cc
@@ -62,3 +62,21 @@ digit2hex (int d)
return digit2hexTbl_[d];
}
+/// Décode un mot signé (1 octets).
+int
+hexSignedChar2int (const char *s) const
+{
+ return (signed char) (hex2digit (s[0]) << 4
+ | hex2digit (s[1]) << 0);
+}
+
+/// Décode un mot signé (2 octets).
+int
+hexSignedShort2int (const char *s) const
+{
+ return (short) (hex2digit (s[0]) << 12
+ | hex2digit (s[1]) << 8
+ | hex2digit (s[2]) << 4
+ | hex2digit (s[3]));
+}
+