diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-09 21:32:54 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-09 21:32:54 +0000 |
commit | 637c49dd0c68f97f67723ca407aa4464ddb02e72 (patch) | |
tree | 08562a6c84ecd38f07a149f80862a93cded59b73 /ace | |
parent | c821aa5fe638e7ca7601e8814de951475eaccf4a (diff) | |
download | ATCD-637c49dd0c68f97f67723ca407aa4464ddb02e72.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 7 | ||||
-rw-r--r-- | ace/ACE.h | 11 | ||||
-rw-r--r-- | ace/ACE.i | 23 |
3 files changed, 35 insertions, 6 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 53668c04fda..9e02c9666e6 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -11,6 +11,9 @@ #include "ace/SString.h" #include "ace/Process.h" +// Hex characters. +const char ACE::hex_chars_[] = "0123456789abcdef"; + // Size of a VM page. size_t ACE::pagesize_ = 0; @@ -240,7 +243,7 @@ ACE::hash_pjw (const ACE_USHORT16 *str) * SUCH DAMAGE. */ -u_long ACE::crctab[] = +u_long ACE::crc_table_[] = { 0x0, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, @@ -302,7 +305,7 @@ u_long ACE::crctab[] = u_long ACE::crc32 (const char *string) { -#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] +#define COMPUTE(var, ch) (var) = (var) << 8 ^ ACE::crc_table_[(var) >> 24 ^ (ch)] register u_long crc = 0; diff --git a/ace/ACE.h b/ace/ACE.h index f6834950944..999986e4be7 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -522,6 +522,12 @@ public: static u_long log2 (u_long num); // Computes the base 2 logarithm of <num>. + static char nibble2hex (u_int n); + // Hex conversion utility. + + static u_char hex2byte (char c); + // Convert a hex character to its byte representation. + private: static int enter_recv_timedwait (ACE_HANDLE handle, const ACE_Time_Value *timeout, @@ -550,8 +556,11 @@ private: static size_t pagesize_; // Size of a VM page. - static u_long crctab[]; + static u_long crc_table_[]; // CRC table. + + static const char hex_chars_[]; + // Hex characters. }; #include "ace/ACE.i" diff --git a/ace/ACE.i b/ace/ACE.i index 0fbddf232b1..4c7ba30a7db 100644 --- a/ace/ACE.i +++ b/ace/ACE.i @@ -4,19 +4,19 @@ // Miscellaneous static methods used throughout ACE. inline u_int -ACE::major_version () +ACE::major_version (void) { return ACE_MAJOR_VERSION; } inline u_int -ACE::minor_version () +ACE::minor_version (void) { return ACE_MINOR_VERSION; } inline u_int -ACE::beta_version () +ACE::beta_version (void) { return ACE_BETA_VERSION; } @@ -102,3 +102,20 @@ ACE::log2 (u_long num) return log; } + +ACE_INLINE char +ACE::nibble2hex (u_int n) +{ + return ACE::hex_chars_[n & 0x0f]; +} + +ACE_INLINE u_char +ACE::hex2byte (char c) +{ + if (isdigit (c)) + return (u_char) (c - '0'); + else if (islower (c)) + return (u_char) (10 + c - 'a'); + else + return (u_char) (10 + c - 'A'); +} |