Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/Common/IntToString.cpp

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Common/IntToString.cpp
2
3 #include "StdAfx.h"
4
5 #include "IntToString.h"
6
7 void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base)
8 {
9 if (base < 2 || base > 36)
10 {
11 *s = '\0';
12 return;
13 }
14 char temp[72];
15 int pos = 0;
16 do
17 {
18 int delta = (int)(value % base);
19 temp[pos++] = (char)((delta < 10) ? ('0' + delta) : ('a' + (delta - 10)));
20 value /= base;
21 }
22 while (value != 0);
23 do
24 *s++ = temp[--pos];
25 while (pos > 0);
26 *s = '\0';
27 }
28
29 void ConvertUInt64ToString(UInt64 value, wchar_t *s)
30 {
31 wchar_t temp[32];
32 int pos = 0;
33 do
34 {
35 temp[pos++] = (wchar_t)(L'0' + (int)(value % 10));
36 value /= 10;
37 }
38 while (value != 0);
39 do
40 *s++ = temp[--pos];
41 while (pos > 0);
42 *s = L'\0';
43 }
44
45 void ConvertInt64ToString(Int64 value, char *s)
46 {
47 if (value < 0)
48 {
49 *s++ = '-';
50 value = -value;
51 }
52 ConvertUInt64ToString(value, s);
53 }
54
55 void ConvertInt64ToString(Int64 value, wchar_t *s)
56 {
57 if (value < 0)
58 {
59 *s++ = L'-';
60 value = -value;
61 }
62 ConvertUInt64ToString(value, s);
63 }
OLDNEW
« no previous file with comments | « third_party/lzma/v4_65/files/CPP/Common/IntToString.h ('k') | third_party/lzma/v4_65/files/CPP/Common/ListFileUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698