20 template<
typename T, std::
size_t N>
23 char *CurPtr = EndPtr;
26 *--CurPtr =
'0' +
char(Value % 10);
29 return EndPtr - CurPtr;
36 int InitialDigits = ((Buffer.
size() - 1) % 3) + 1;
38 S.
write(ThisGroup.data(), ThisGroup.size());
42 while (!Buffer.
empty()) {
45 S.
write(ThisGroup.data(), 3);
53 static_assert(std::is_unsigned<T>::value,
"Value is not unsigned!");
55 char NumberBuffer[128];
56 std::memset(NumberBuffer,
'0',
sizeof(NumberBuffer));
65 for (
size_t I = Len;
I < MinDigits; ++
I)
80 if (N == static_cast<uint32_t>(N))
90 static_assert(std::is_signed<T>::value,
"Value is not signed!");
92 using UnsignedT =
typename std::make_unsigned<T>::type;
99 UnsignedT UN = -(UnsignedT)N;
135 const size_t kMaxWidth = 128u;
137 size_t W = std::min(kMaxWidth, Width.
getValueOr(0u));
144 unsigned PrefixChars = Prefix ? 2 : 0;
148 char NumberBuffer[kMaxWidth];
151 NumberBuffer[1] =
'x';
152 char *EndPtr = NumberBuffer + NumChars;
153 char *CurPtr = EndPtr;
155 unsigned char x =
static_cast<unsigned char>(
N) % 16;
160 S.
write(NumberBuffer, NumChars);
170 }
else if (std::isinf(N)) {
185 Out <<
"%." << Prec << Letter;
192 #if defined(__MINGW32__) 194 if (N == 0.0 && std::signbit(N)) {
195 char NegativeZero[] =
"-0.000000e+00";
197 NegativeZero[strlen(NegativeZero) - 4] =
'E';
202 int fpcl = _fpclass(N);
205 if (fpcl == _FPCLASS_NZ) {
206 char NegativeZero[] =
"-0.000000e+00";
208 NegativeZero[strlen(NegativeZero) - 4] =
'E';
216 len =
format(Spec.
c_str(),
N).snprint(buf,
sizeof(buf));
217 if (len <=
sizeof(buf) - 2) {
218 if (len >= 5 && (buf[len - 5] ==
'e' || buf[len - 5] ==
'E') &&
219 buf[len - 3] ==
'0') {
220 int cs = buf[len - 4];
221 if (cs ==
'+' || cs ==
'-') {
222 int c1 = buf[len - 2];
223 int c0 = buf[len - 1];
224 if (isdigit(static_cast<unsigned char>(c1)) &&
225 isdigit(static_cast<unsigned char>(c0))) {
262 LLVM_BUILTIN_UNREACHABLE;
const_iterator end(StringRef path)
Get end iterator over path.
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
This class represents lattice values for constants.
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
A raw_ostream that writes to an SmallVector or SmallString.
void write_double(raw_ostream &S, double D, FloatStyle Style, Optional< size_t > Precision=None)
size_t getDefaultPrecision(FloatStyle Style)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isPrefixedHexStyle(HexPrintStyle S)
char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16)...
size_t size() const
size - Get the array size.
unsigned countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
raw_ostream & write(unsigned char C)
Align max(MaybeAlign Lhs, Align Rhs)
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style, Optional< size_t > Width=None)
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits, IntegerStyle Style)
bool empty() const
empty - Check if the array is empty.