From 73301302d22cca6d64c4e778b5bb2681eca13c0c Mon Sep 17 00:00:00 2001 From: schodet Date: Sun, 9 May 2004 17:55:28 +0000 Subject: Point: operator- Hexa: unsigned char. --- 2004/i/nono/src/utils/hexa.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to '2004/i/nono/src/utils/hexa.cc') diff --git a/2004/i/nono/src/utils/hexa.cc b/2004/i/nono/src/utils/hexa.cc index 236342b..d5e4716 100644 --- a/2004/i/nono/src/utils/hexa.cc +++ b/2004/i/nono/src/utils/hexa.cc @@ -63,6 +63,17 @@ digit2hex (int d) return digit2hexTbl_[d]; } +/// Décode un mot non-signé (1 octets). +unsigned int +hexUnsignedChar2int (const char *s) +{ + int h1 = hex2digit (s[0]); + int h0 = hex2digit (s[1]); + if (h1 == hexInvalid || h0 == hexInvalid) + return hexInvalid; + return (unsigned char) (h1 << 4 | h0); +} + /// Décode un mot signé (1 octets). int hexSignedChar2int (const char *s) -- cgit v1.2.3