libstrat: convert to experimental new (super-accurate) sf allocation semantics

This commit is contained in:
Michael Scire 2021-01-17 07:55:32 -08:00 committed by SciresM
parent 8314d015f3
commit f06de12bea
149 changed files with 2852 additions and 1746 deletions

View file

@ -26,6 +26,7 @@ namespace ams::erpt {
R_DEFINE_ERROR_RESULT(OutOfArraySpace, 3);
R_DEFINE_ERROR_RESULT(OutOfFieldSpace, 4);
R_DEFINE_ERROR_RESULT(OutOfMemory, 5);
R_DEFINE_ERROR_RESULT(NotSupported, 6);
R_DEFINE_ERROR_RESULT(InvalidArgument, 7);
R_DEFINE_ERROR_RESULT(NotFound, 8);
R_DEFINE_ERROR_RESULT(FieldCategoryMismatch, 9);

View file

@ -27,5 +27,6 @@ namespace ams::pgl {
R_DEFINE_ERROR_RESULT(BufferNotEnough, 4);
R_DEFINE_ERROR_RESULT(ApplicationContentNotFound, 5);
R_DEFINE_ERROR_RESULT(ContentMetaNotFound, 6);
R_DEFINE_ERROR_RESULT(OutOfMemory, 7);
}

View file

@ -23,6 +23,7 @@
#include <vapours/util/util_size.hpp>
#include <vapours/util/util_aligned_buffer.hpp>
#include <vapours/util/util_endian.hpp>
#include <vapours/util/util_exchange.hpp>
#include <vapours/util/util_scope_guard.hpp>
#include <vapours/util/util_specialization_of.hpp>
#include <vapours/util/util_bitpack.hpp>

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vapours/common.hpp>
#include <vapours/assert.hpp>
namespace ams::util {
template<typename T, typename U> requires (std::is_assignable<T&, U&&>::value && std::is_copy_constructible<T>::value && std::is_move_constructible<T>::value)
constexpr inline T Exchange(T *ptr, U value) {
AMS_ASSERT(ptr != nullptr);
auto ret = std::move(*ptr);
*ptr = std::move(value);
return ret;
}
template<typename T>
constexpr inline T *Exchange(T **ptr, std::nullptr_t) {
AMS_ASSERT(ptr != nullptr);
auto ret(*ptr);
*ptr = nullptr;
return ret;
}
}