diff src/win32/7zip/7z/CPP/7zip/Common/MethodId.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Common/MethodId.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,27 @@
     1.4 +// MethodId.cpp
     1.5 +
     1.6 +#include "StdAfx.h"
     1.7 +
     1.8 +#include "MethodId.h"
     1.9 +#include "../../Common/MyString.h"
    1.10 +
    1.11 +static inline wchar_t GetHex(Byte value)
    1.12 +{
    1.13 +  return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
    1.14 +}
    1.15 +
    1.16 +UString ConvertMethodIdToString(UInt64 id)
    1.17 +{
    1.18 +  wchar_t s[32];
    1.19 +  int len = 32;
    1.20 +  s[--len] = 0;
    1.21 +  do
    1.22 +  {
    1.23 +    s[--len] = GetHex((Byte)id & 0xF);
    1.24 +    id >>= 4;
    1.25 +    s[--len] = GetHex((Byte)id & 0xF);
    1.26 +    id >>= 4;
    1.27 +  }
    1.28 +  while (id != 0);
    1.29 +  return s + len;
    1.30 +}