21 template<
typename T, std::
size_t N>
24 char *CurPtr = EndPtr;
27 *--CurPtr =
'0' +
char(Value % 10);
30 return EndPtr - CurPtr;
37 int InitialDigits = ((Buffer.
size() - 1) % 3) + 1;
39 S.
write(ThisGroup.data(), ThisGroup.size());
43 while (!Buffer.
empty()) {
46 S.
write(ThisGroup.data(), 3);
54 static_assert(std::is_unsigned<T>::value,
"Value is not unsigned!");
56 char NumberBuffer[128];
57 std::memset(NumberBuffer,
'0',
sizeof(NumberBuffer));
66 for (
size_t I = Len;
I < MinDigits; ++
I)
81 if (N == static_cast<uint32_t>(N))
91 static_assert(std::is_signed<T>::value,
"Value is not signed!");
93 using UnsignedT =
typename std::make_unsigned<T>::type;
100 UnsignedT UN = -(UnsignedT)N;
136 const size_t kMaxWidth = 128u;
138 size_t W = std::min(kMaxWidth, Width.
getValueOr(0u));
145 unsigned PrefixChars = Prefix ? 2 : 0;
149 char NumberBuffer[kMaxWidth];
152 NumberBuffer[1] =
'x';
153 char *EndPtr = NumberBuffer + NumChars;
154 char *CurPtr = EndPtr;
156 unsigned char x =
static_cast<unsigned char>(
N) % 16;
161 S.
write(NumberBuffer, NumChars);
171 }
else if (std::isinf(N)) {
186 Out <<
"%." << Prec << Letter;
193 #if defined(__MINGW32__) 195 if (N == 0.0 && std::signbit(N)) {
196 char NegativeZero[] =
"-0.000000e+00";
198 NegativeZero[strlen(NegativeZero) - 4] =
'E';
203 int fpcl = _fpclass(N);
206 if (fpcl == _FPCLASS_NZ) {
207 char NegativeZero[] =
"-0.000000e+00";
209 NegativeZero[strlen(NegativeZero) - 4] =
'E';
217 len =
format(Spec.
c_str(),
N).snprint(buf,
sizeof(buf));
218 if (len <=
sizeof(buf) - 2) {
219 if (len >= 5 && (buf[len - 5] ==
'e' || buf[len - 5] ==
'E') &&
220 buf[len - 3] ==
'0') {
221 int cs = buf[len - 4];
222 if (cs ==
'+' || cs ==
'-') {
223 int c1 = buf[len - 2];
224 int c0 = buf[len - 1];
225 if (isdigit(static_cast<unsigned char>(c1)) &&
226 isdigit(static_cast<unsigned char>(c0))) {
263 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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
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.
std::size_t 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...
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.
raw_ostream & write(unsigned char C)
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.