1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-18 18:06:40 +00:00
Atmosphere/libraries/libstratosphere/include/stratosphere/fs
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
..
common fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fsa util: add pointer utils, use to constrain fs pointers 2022-03-24 16:21:03 -07:00
impl fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_access_log.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_api.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_application.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_bis.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_code.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_code_verification_data.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_common.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_content.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_content_storage.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_context.hpp strat: use m_ for member variables 2021-10-10 00:14:06 -07:00
fs_device_save_data.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_directory.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_file.hpp ams: support building unit test programs on windows/linux/macos 2022-03-21 17:21:44 -07:00
fs_filesystem.hpp util: add pointer utils, use to constrain fs pointers 2022-03-24 16:21:03 -07:00
fs_filesystem_for_debug.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_filesystem_utils.hpp ams: support building unit test programs on windows/linux/macos 2022-03-21 17:21:44 -07:00
fs_game_card.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_host.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_i_buffer_manager.hpp fs: first pass at compressed storage (works on iridium with wip hac2l code) 2022-03-21 17:21:44 -07:00
fs_i_event_notifier.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_image_directory.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_istorage.hpp util: add pointer utils, use to constrain fs pointers 2022-03-24 16:21:03 -07:00
fs_memory_management.hpp fs: reduce path size 0x28 -> 0x18 2022-03-24 20:22:47 -07:00
fs_memory_storage.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_mount.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_operate_range.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_path.hpp fs: reduce path size 0x28 -> 0x18 2022-03-24 20:22:47 -07:00
fs_path_utility.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_priority.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_program_index_map_info.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_query_range.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_read_only_filesystem.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_remote_filesystem.hpp fs: revise allocation-fail result names 2022-03-21 17:21:44 -07:00
fs_remote_storage.hpp ams: support building unit test programs on windows/linux/macos 2022-03-21 17:21:44 -07:00
fs_result_config.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_rights_id.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_romfs_filesystem.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_save_data_management.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_save_data_transaction.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_save_data_types.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_sd_card.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_signed_system_partition.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_speed_emulation.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_storage_type.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_substorage.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_system_data.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
fs_system_save_data.hpp fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00