misc/libphysfs/lzma/CPP/7zip/Common/MethodId.cpp
author Wuzzy <Wuzzy2@mail.ru>
Wed, 22 Aug 2018 16:47:09 +0200
branch0.9.24
changeset 13690 09757d5aead3
parent 12213 bb5522e88ab2
permissions -rw-r--r--
Backed out changeset 076b7d23fab8. Well, the commit in question was needed after all ...

// MethodId.cpp

#include "StdAfx.h"

#include "MethodId.h"
#include "../../Common/MyString.h"

static inline wchar_t GetHex(Byte value)
{
  return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
}

UString ConvertMethodIdToString(UInt64 id)
{
  wchar_t s[32];
  int len = 32;
  s[--len] = 0;
  do
  {
    s[--len] = GetHex((Byte)id & 0xF);
    id >>= 4;
    s[--len] = GetHex((Byte)id & 0xF);
    id >>= 4;
  }
  while (id != 0);
  return s + len;
}