Go to the documentation of this file.
19 #if defined(_WIN32) && !defined(__MINGW32__)
25 template<
typename T, std::
size_t N>
28 char *CurPtr = EndPtr;
31 *--CurPtr =
'0' + char(
Value % 10);
34 return EndPtr - CurPtr;
41 int InitialDigits = ((Buffer.
size() - 1) % 3) + 1;
43 S.write(ThisGroup.
data(), ThisGroup.
size());
47 while (!Buffer.
empty()) {
50 S.write(ThisGroup.
data(), 3);
58 static_assert(std::is_unsigned_v<T>,
"Value is not unsigned!");
60 char NumberBuffer[128];
67 for (
size_t I = Len;
I < MinDigits; ++
I)
74 S.write(
std::end(NumberBuffer) - Len, Len);
92 static_assert(std::is_signed_v<T>,
"Value is not signed!");
94 using UnsignedT = std::make_unsigned_t<T>;
101 UnsignedT UN = -(UnsignedT)
N;
136 std::optional<size_t>
Width) {
137 const size_t kMaxWidth = 128u;
146 unsigned PrefixChars =
Prefix ? 2 : 0;
150 char NumberBuffer[kMaxWidth];
151 ::memset(NumberBuffer,
'0',
std::size(NumberBuffer));
153 NumberBuffer[1] =
'x';
154 char *EndPtr = NumberBuffer + NumChars;
155 char *CurPtr = EndPtr;
157 unsigned char x =
static_cast<unsigned char>(
N) % 16;
158 *--CurPtr = hexdigit(
x, !
Upper);
162 S.write(NumberBuffer, NumChars);
166 std::optional<size_t> Precision) {
172 }
else if (std::isinf(
N)) {
173 S << (std::signbit(
N) ?
"-INF" :
"INF");
187 Out <<
"%." << Prec << Letter;
194 #if defined(__MINGW32__)
196 if (
N == 0.0 && std::signbit(
N)) {
197 char NegativeZero[] =
"-0.000000e+00";
199 NegativeZero[strlen(NegativeZero) - 4] =
'E';
204 int fpcl = _fpclass(
N);
207 if (fpcl == _FPCLASS_NZ) {
208 char NegativeZero[] =
"-0.000000e+00";
210 NegativeZero[strlen(NegativeZero) - 4] =
'E';
218 len =
format(
Spec.c_str(),
N).snprint(buf,
sizeof(buf));
219 if (len <=
sizeof(buf) - 2) {
220 if (len >= 5 && (buf[len - 5] ==
'e' || buf[len - 5] ==
'E') &&
221 buf[len - 3] ==
'0') {
222 int cs = buf[len - 4];
223 if (cs ==
'+' || cs ==
'-') {
224 int c1 = buf[len - 2];
225 int c0 = buf[len - 1];
226 if (isdigit(
static_cast<unsigned char>(c1)) &&
227 isdigit(
static_cast<unsigned char>(c0))) {
int bit_width(T Value)
Returns the number of bits needed to represent Value if Value is nonzero.
This is an optimization pass for GlobalISel generic memory operations.
const_iterator end(StringRef path)
Get end iterator over path.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
bool empty() const
empty - Check if the array is empty.
void write_double(raw_ostream &S, double D, FloatStyle Style, std::optional< size_t > Precision=std::nullopt)
This class implements an extremely fast bulk output stream that can only output to a stream.
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
size_t getDefaultPrecision(FloatStyle Style)
void write_hex(raw_ostream &S, uint64_t N, HexPrintStyle Style, std::optional< size_t > Width=std::nullopt)
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
bool isPrefixedHexStyle(HexPrintStyle S)
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
void write_integer(raw_ostream &S, unsigned int N, size_t MinDigits, IntegerStyle Style)
size_t size() const
size - Get the array size.
A raw_ostream that writes to an SmallVector or SmallString.
LLVM Value Representation.