summaryrefslogtreecommitdiff
path: root/2004
diff options
context:
space:
mode:
authorschodet2004-05-19 13:12:05 +0000
committerschodet2004-05-19 13:12:05 +0000
commit74f6f87c65456256192285886659328b0efe5915 (patch)
tree132ce908359db2a0576c94e34e99a8e30e9d7c19 /2004
parent5af26ff4016fdd2a14abd5d7e4540e87161822e4 (diff)
Ajout unsigned int
Diffstat (limited to '2004')
-rw-r--r--2004/i/nono/src/utils/hexa.cc13
-rw-r--r--2004/i/nono/src/utils/hexa.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/2004/i/nono/src/utils/hexa.cc b/2004/i/nono/src/utils/hexa.cc
index d5e4716..2368f09 100644
--- a/2004/i/nono/src/utils/hexa.cc
+++ b/2004/i/nono/src/utils/hexa.cc
@@ -98,3 +98,16 @@ hexSignedShort2int (const char *s)
return (short) (h3 << 12 | h2 << 8 | h1 << 4 | h0);
}
+/// Décode un mot non-signé (2 octets).
+int
+hexUnsignedShort2int (const char *s)
+{
+ int h3 = hex2digit (s[0]);
+ int h2 = hex2digit (s[1]);
+ int h1 = hex2digit (s[2]);
+ int h0 = hex2digit (s[3]);
+ if (h3 == hexInvalid || h2 == hexInvalid || h1 == hexInvalid || h0 == hexInvalid)
+ return hexInvalid;
+ return (unsigned short) (h3 << 12 | h2 << 8 | h1 << 4 | h0);
+}
+
diff --git a/2004/i/nono/src/utils/hexa.h b/2004/i/nono/src/utils/hexa.h
index c2a0259..ee9e2ca 100644
--- a/2004/i/nono/src/utils/hexa.h
+++ b/2004/i/nono/src/utils/hexa.h
@@ -40,6 +40,9 @@ unsigned int hexUnsignedChar2int (const char *s);
/// Décode un mot signé (1 octets).
int hexSignedChar2int (const char *s);
+/// Décode un mot non-signé (2 octets).
+int hexUnsignedShort2int (const char *s);
+
/// Décode un mot signé (2 octets).
int hexSignedShort2int (const char *s);