MCPcopy Create free account
hub / github.com/catboost/catboost / FormatIntValue

Function FormatIntValue

library/cpp/yt/string/format.cpp:71–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70template <class TValue>
71void FormatIntValue(
72 TStringBuilderBase* builder,
73 TValue value,
74 TStringBuf format,
75 TStringBuf genericSpec)
76{
77 if (format == TStringBuf("v")) {
78 constexpr int MaxResultSize = 64;
79 char buffer[MaxResultSize];
80 char* end = buffer + MaxResultSize;
81 char* start = WriteDecIntToBufferBackwards(end, value);
82 builder->AppendString(TStringBuf(start, end));
83 } else if (format == TStringBuf("x") || format == TStringBuf("X")) {
84 constexpr int MaxResultSize = 64;
85 char buffer[MaxResultSize];
86 char* end = buffer + MaxResultSize;
87 char* start = WriteHexIntToBufferBackwards(end, value, format[0] == 'X');
88 builder->AppendString(TStringBuf(start, end));
89 } else {
90 FormatValueViaSprintf(builder, value, format, genericSpec);
91 }
92}
93
94#define XX(type) \
95 template \

Callers

nothing calls this directly

Calls 4

FormatValueViaSprintfFunction · 0.85
AppendStringMethod · 0.45

Tested by

no test coverage detected