mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-22 02:45:07 -04:00
os: implement ExpandUnsignedValueToAscii
Nintendo does this as of latest firmware. It's desirable because it removes the only usage of util::SNPrintf() from os library, which means programs which don't otherwise use SNPrintf do not need to link it into .text. This saves ~0xD40 of .text as of time-of-commit when successfully unlinking, and e.g. reduces our sm (and other modules) memory size by a page.
This commit is contained in:
parent
1e7a327a25
commit
15ff64e03a
3 changed files with 69 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
#include "os_waitable_holder_base.hpp"
|
||||
#include "os_waitable_holder_impl.hpp"
|
||||
#include "os_waitable_object_list.hpp"
|
||||
#include "os_utility.hpp"
|
||||
|
||||
namespace ams::os::impl {
|
||||
|
||||
|
@ -223,7 +224,8 @@ namespace ams::os::impl {
|
|||
constexpr size_t ThreadNamePrefixSize = sizeof(ThreadNamePrefix) - 1;
|
||||
const u64 func = reinterpret_cast<u64>(thread->function);
|
||||
static_assert(ThreadNamePrefixSize + sizeof(func) * 2 + 1 <= sizeof(thread->name_buffer));
|
||||
util::SNPrintf(thread->name_buffer, sizeof(thread->name_buffer), "%s%016lX", ThreadNamePrefix, func);
|
||||
std::memcpy(thread->name_buffer, ThreadNamePrefix, ThreadNamePrefixSize);
|
||||
os::impl::ExpandUnsignedValueToAscii(thread->name_buffer + ThreadNamePrefixSize, func);
|
||||
}
|
||||
|
||||
thread->name_pointer = thread->name_buffer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue