mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Mark ctl::to_string() noexcept
This commit is contained in:
parent
e627bfa359
commit
c1f8d0678c
3 changed files with 18 additions and 19 deletions
18
ctl/string.h
18
ctl/string.h
|
@ -426,31 +426,31 @@ static_assert(sizeof(__::small_string) == __::string_size);
|
||||||
static_assert(sizeof(__::big_string) == __::string_size);
|
static_assert(sizeof(__::big_string) == __::string_size);
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(int);
|
to_string(int) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(long);
|
to_string(long) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(long long);
|
to_string(long long) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(unsigned);
|
to_string(unsigned) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(unsigned long);
|
to_string(unsigned long) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(unsigned long long);
|
to_string(unsigned long long) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(float);
|
to_string(float) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(double);
|
to_string(double) noexcept;
|
||||||
|
|
||||||
ctl::string
|
ctl::string
|
||||||
to_string(long double);
|
to_string(long double) noexcept;
|
||||||
|
|
||||||
} // namespace ctl
|
} // namespace ctl
|
||||||
|
|
||||||
|
|
|
@ -27,49 +27,49 @@ namespace ctl {
|
||||||
extern const double_conversion::DoubleToStringConverter kDoubleToPrintfG;
|
extern const double_conversion::DoubleToStringConverter kDoubleToPrintfG;
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(int value)
|
to_string(int value) noexcept
|
||||||
{
|
{
|
||||||
char buf[12];
|
char buf[12];
|
||||||
return { buf, FormatInt32(buf, value) - buf };
|
return { buf, FormatInt32(buf, value) - buf };
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(unsigned value)
|
to_string(unsigned value) noexcept
|
||||||
{
|
{
|
||||||
char buf[12];
|
char buf[12];
|
||||||
return { buf, FormatUint32(buf, value) - buf };
|
return { buf, FormatUint32(buf, value) - buf };
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(long value)
|
to_string(long value) noexcept
|
||||||
{
|
{
|
||||||
char buf[21];
|
char buf[21];
|
||||||
return { buf, FormatInt64(buf, value) - buf };
|
return { buf, FormatInt64(buf, value) - buf };
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(unsigned long value)
|
to_string(unsigned long value) noexcept
|
||||||
{
|
{
|
||||||
char buf[21];
|
char buf[21];
|
||||||
return { buf, FormatUint64(buf, value) - buf };
|
return { buf, FormatUint64(buf, value) - buf };
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(long long value)
|
to_string(long long value) noexcept
|
||||||
{
|
{
|
||||||
char buf[21];
|
char buf[21];
|
||||||
return { buf, FormatInt64(buf, value) - buf };
|
return { buf, FormatInt64(buf, value) - buf };
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(unsigned long long value)
|
to_string(unsigned long long value) noexcept
|
||||||
{
|
{
|
||||||
char buf[21];
|
char buf[21];
|
||||||
return { buf, FormatUint64(buf, value) - buf };
|
return { buf, FormatUint64(buf, value) - buf };
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(float value)
|
to_string(float value) noexcept
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
double_conversion::StringBuilder b(buf, sizeof(buf));
|
double_conversion::StringBuilder b(buf, sizeof(buf));
|
||||||
|
@ -79,7 +79,7 @@ to_string(float value)
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(double value)
|
to_string(double value) noexcept
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
double_conversion::StringBuilder b(buf, sizeof(buf));
|
double_conversion::StringBuilder b(buf, sizeof(buf));
|
||||||
|
@ -89,7 +89,7 @@ to_string(double value)
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
to_string(long double value)
|
to_string(long double value) noexcept
|
||||||
{
|
{
|
||||||
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
||||||
return to_string((double)value);
|
return to_string((double)value);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include "ctl/string.h"
|
#include "ctl/string.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
#include "libc/mem/leaks.h"
|
#include "libc/mem/leaks.h"
|
||||||
|
|
Loading…
Reference in a new issue