MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / decode

Function decode

src/common/classes/MsgPrint.cpp:62–91  ·  view source on GitHub ↗

Decode unsigned integer values in any base between 10 and 36.

Source from the content-addressed store, hash-verified

60
61// Decode unsigned integer values in any base between 10 and 36.
62int decode(uint64_t value, char* const rc, int radix)
63{
64 int rev = DECODE_BUF_LEN;
65 if (radix < MIN_RADIX || radix > MAX_RADIX)
66 radix = MIN_RADIX;
67
68 if (radix == 10) // go faster for this option
69 {
70 while (true)
71 {
72 rc[rev--] = static_cast<unsigned char>(value % 10) + '0';
73 value /= 10;
74 if (!value)
75 break;
76 }
77 }
78 else
79 {
80 while (true)
81 {
82 int temp = static_cast<int>(value % radix);
83 rc[rev--] = static_cast<unsigned char>(temp < 10 ? temp + '0' : temp - 10 + 'A');
84 value /= radix;
85 if (!value)
86 break;
87 }
88 }
89
90 return adjust_prefix(radix, rev, false, rc);
91}
92
93
94// Decode signed integer values in any base between 10 and 36.

Callers 8

MsgPrintHelperFunction · 0.85
getYearMethod · 0.85
getMonthMethod · 0.85
getDayMethod · 0.85
getHoursMethod · 0.85
getMinutesMethod · 0.85
getSecondsMethod · 0.85
getFractionsMethod · 0.85

Calls 1

adjust_prefixFunction · 0.85

Tested by

no test coverage detected