You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
527 B

#include "utils/str_cat.hpp"
#include <cstddef>
#include <fmt/compile.h>
#include <fmt/core.h>
namespace devilution {
namespace {
template <typename T>
constexpr size_t MaxDecimalDigits = 241 * sizeof(T) / 100 + 1;
} // namespace
char *BufCopy(char *out, int value)
{
return fmt::format_to(out, FMT_COMPILE("{}"), value);
}
void StrAppend(std::string &out, int value)
{
char buf[MaxDecimalDigits<int> + 1];
out.append(&buf[0], BufCopy(buf, value) - &buf[0]);
}
} // namespace devilution