1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-11 06:26:41 +00:00
Atmosphere/libraries/libstratosphere
SciresM 64c6ef2de7
fs: reduce path size 0x28 -> 0x18
This implements two optimizations on fs::Path, which N added in 12.0.0.

The current structure looks like: 

```cpp
struct Path {
    const char *m_str; // Points to the read-only path string
    char *m_write_buffer_buffer; // Part of std::unique_ptr<char[], ams::fs::impl::Deleter>
    ams::fs::impl::Deleter m_write_buffer_deleter; // Parse of std::unique_ptr<char[], ams::fs::impl::Deleter>, stores the size of the buffer.
    size_t m_write_buffer_length; // Copy of the write buffer's size accessible to the Path() structure.
    bool m_is_normalized; // Whether the path buffer is normalized
};
```

This is pretty wasteful. The write buffer size is stored twice, wasting 8 bytes, because one copy of the size isn't accessible to the path.

In addition, due to alignment, the bool wastes 7 padding bytes.

This commit:

* Encodes normalized in the low bit of the write buffer length, saving 8 bytes.
* Use a custom WriteBuffer class rather than generic unique_ptr, to avoid needing to store the WriteBuffer twice.


These each save 8 bytes, for a final size of 0x18 rather than 0x28.
2022-03-24 20:22:47 -07:00
..
include fs: reduce path size 0x28 -> 0x18 2022-03-24 20:22:47 -07:00
source fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
discard-ehframe.ld stratosphere: discard unnecessary .eh_frame segment 2021-01-13 08:30:24 -08:00
libstratosphere.mk abort/error: print backtrace, abuse templates, overhaul result/diag (macos not done yet) 2022-03-21 17:21:44 -07:00
Makefile ams: support building unit test programs on windows/linux/macos 2022-03-21 17:21:44 -07:00
README.md licensing: update exemptions (approved by contributors). 2020-04-16 17:33:04 -07:00
stratosphere.specs stratosphere: discard unnecessary .eh_frame segment 2021-01-13 08:30:24 -08:00

License

libstratosphere is a work-in-progress C++ library for development of system modules for the Nintendo Switch.

It is built around extending libnx.

It also provides bindings for custom extensions to Horizon OS implemented by Atmosphère.

Licensing

This software is licensed under the terms of the GPLv2, with exemptions for specific projects noted below.

You can find a copy of the license in the LICENSE file.

Exemptions:

  • The yuzu Nintendo Switch emulator and the Ryujinx Team and Contributors are exempt from GPLv2 licensing. They are permitted, each at their individual discretion, to instead license any source code authored for the libstratosphere project as either GPLv2 or later or the MIT license. In doing so, they may alter, supplement, or entirely remove the copyright notice for each file they choose to relicense. Neither the Atmosphère project nor its individual contributors shall assert their moral rights against any of the aforementioned projects.
  • Nintendo is exempt from GPLv2 licensing and may (at its option) instead license any source code authored for the libstratosphere project under the Zero-Clause BSD license.

Credits

libstratosphere is currently being developed and maintained by SciresM.

In addition to those credited in Atmosphère's credits, we would like to thank for contributing to libstratosphere in some significant way:

  • hthh
  • fincs
  • lioncash
  • misson20000
  • neobrain
  • yellows8
  • @Nintendo