mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Add support for 64-bit size_t
This commit is contained in:
parent
ce56770875
commit
dc93ed4368
Notes:
sideshowbarker
2024-07-19 09:38:54 +09:00
Author: https://github.com/jcs Commit: https://github.com/SerenityOS/serenity/commit/dc93ed43683 Pull-request: https://github.com/SerenityOS/serenity/pull/1177
4 changed files with 18 additions and 13 deletions
|
@ -62,6 +62,11 @@ const LogStream& operator<<(const LogStream& stream, u64 value)
|
||||||
return stream << String::number(value);
|
return stream << String::number(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LogStream& operator<<(const LogStream& stream, unsigned long value)
|
||||||
|
{
|
||||||
|
return stream << String::number(value);
|
||||||
|
}
|
||||||
|
|
||||||
const LogStream& operator<<(const LogStream& stream, const void* value)
|
const LogStream& operator<<(const LogStream& stream, const void* value)
|
||||||
{
|
{
|
||||||
return stream << String::format("%p", value);
|
return stream << String::format("%p", value);
|
||||||
|
|
|
@ -88,17 +88,9 @@ const LogStream& operator<<(const LogStream&, const String&);
|
||||||
const LogStream& operator<<(const LogStream&, const StringView&);
|
const LogStream& operator<<(const LogStream&, const StringView&);
|
||||||
const LogStream& operator<<(const LogStream&, i32);
|
const LogStream& operator<<(const LogStream&, i32);
|
||||||
const LogStream& operator<<(const LogStream&, u32);
|
const LogStream& operator<<(const LogStream&, u32);
|
||||||
|
const LogStream& operator<<(const LogStream&, i64);
|
||||||
const LogStream& operator<<(const LogStream&, u64);
|
const LogStream& operator<<(const LogStream&, u64);
|
||||||
|
const LogStream& operator<<(const LogStream&, unsigned long);
|
||||||
#ifdef __serenity__
|
|
||||||
inline const LogStream& operator<<(const LogStream& stream, size_t value)
|
|
||||||
{
|
|
||||||
if constexpr (sizeof(size_t) == 4)
|
|
||||||
return stream << (u32)value;
|
|
||||||
else
|
|
||||||
return stream << (u64)value;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const LogStream& operator<<(const LogStream&, const void*);
|
const LogStream& operator<<(const LogStream&, const void*);
|
||||||
|
|
||||||
|
|
|
@ -234,13 +234,16 @@ public:
|
||||||
static String number(u64);
|
static String number(u64);
|
||||||
static String number(u32);
|
static String number(u32);
|
||||||
static String number(i32);
|
static String number(i32);
|
||||||
|
static String number(i64);
|
||||||
|
|
||||||
#ifdef __serenity__
|
|
||||||
static String number(size_t n)
|
static String number(size_t n)
|
||||||
{
|
{
|
||||||
|
if constexpr(sizeof(size_t) == 4)
|
||||||
return number((u32)n);
|
return number((u32)n);
|
||||||
|
else if constexpr(sizeof(size_t) == 8)
|
||||||
|
return number((u64)n);
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
StringView view() const
|
StringView view() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,6 +82,11 @@ typedef int8_t i8;
|
||||||
typedef int16_t i16;
|
typedef int16_t i16;
|
||||||
typedef int32_t i32;
|
typedef int32_t i32;
|
||||||
typedef int64_t i64;
|
typedef int64_t i64;
|
||||||
|
|
||||||
|
#ifdef __ptrdiff_t
|
||||||
|
typedef __PTRDIFF_TYPE__ __ptrdiff_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr unsigned KB = 1024;
|
constexpr unsigned KB = 1024;
|
||||||
|
|
Loading…
Reference in a new issue