Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MethodId.cpp « Common « 7zip « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1eed8fc15724add386cd88b01dcd931d3de4bf31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// MethodId.cpp

#include "StdAfx.h"

#include "MethodId.h"
#include "../../Common/String.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;
}