MCPcopy Create free account
hub / github.com/ablab/spades / toString

Method toString

ext/src/llvm/APInt.cpp:2166–2277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2164}
2165
2166void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix,
2167 bool Signed, bool formatAsCLiteral) const {
2168 assert((Radix == 10 || Radix == 8 || Radix == 16 || Radix == 2 ||
2169 Radix == 36) &&
2170 "Radix should be 2, 8, 10, 16, or 36!");
2171
2172 const char *Prefix = "";
2173 if (formatAsCLiteral) {
2174 switch (Radix) {
2175 case 2:
2176 // Binary literals are a non-standard extension added in gcc 4.3:
2177 // http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Binary-constants.html
2178 Prefix = "0b";
2179 break;
2180 case 8:
2181 Prefix = "0";
2182 break;
2183 case 10:
2184 break; // No prefix
2185 case 16:
2186 Prefix = "0x";
2187 break;
2188 default:
2189 llvm_unreachable("Invalid radix!");
2190 }
2191 }
2192
2193 // First, check for a zero value and just short circuit the logic below.
2194 if (*this == 0) {
2195 while (*Prefix) {
2196 Str.push_back(*Prefix);
2197 ++Prefix;
2198 };
2199 Str.push_back('0');
2200 return;
2201 }
2202
2203 static const char Digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
2204
2205 if (isSingleWord()) {
2206 char Buffer[65];
2207 char *BufPtr = std::end(Buffer);
2208
2209 uint64_t N;
2210 if (!Signed) {
2211 N = getZExtValue();
2212 } else {
2213 int64_t I = getSExtValue();
2214 if (I >= 0) {
2215 N = I;
2216 } else {
2217 Str.push_back('-');
2218 N = -(uint64_t)I;
2219 }
2220 }
2221
2222 while (*Prefix) {
2223 Str.push_back(*Prefix);

Callers 8

printMethod · 0.95
jquery-ui.min.jsFile · 0.45
jquery.console.jsFile · 0.45
getWorkerFnFunction · 0.45
sra_parser.cppFile · 0.45
typeHLA.jsFile · 0.45
bwa_postaltFunction · 0.45
typeHLA-selctg.jsFile · 0.45

Calls 15

assertClass · 0.85
isSingleWordFunction · 0.85
getZExtValueFunction · 0.85
getSExtValueFunction · 0.85
lshrInPlaceMethod · 0.80
endFunction · 0.70
isNegativeFunction · 0.50
reverseFunction · 0.50
toStringFunction · 0.50
push_backMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected