misc/libphysfs/lzma/CPP/7zip/Common/MethodId.cpp
branchui-scaling
changeset 15283 c4fd2813b127
parent 13390 0135e64c6c66
parent 15279 7ab5cf405686
child 15663 d92eeb468dad
equal deleted inserted replaced
13390:0135e64c6c66 15283:c4fd2813b127
     1 // MethodId.cpp
       
     2 
       
     3 #include "StdAfx.h"
       
     4 
       
     5 #include "MethodId.h"
       
     6 #include "../../Common/MyString.h"
       
     7 
       
     8 static inline wchar_t GetHex(Byte value)
       
     9 {
       
    10   return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
       
    11 }
       
    12 
       
    13 UString ConvertMethodIdToString(UInt64 id)
       
    14 {
       
    15   wchar_t s[32];
       
    16   int len = 32;
       
    17   s[--len] = 0;
       
    18   do
       
    19   {
       
    20     s[--len] = GetHex((Byte)id & 0xF);
       
    21     id >>= 4;
       
    22     s[--len] = GetHex((Byte)id & 0xF);
       
    23     id >>= 4;
       
    24   }
       
    25   while (id != 0);
       
    26   return s + len;
       
    27 }