fs: implement PooledBuffer

This commit is contained in:
Michael Scire 2020-04-06 03:15:24 -07:00
parent 50a91b1d6e
commit 496be5ecd4
5 changed files with 521 additions and 6 deletions

View file

@ -17,16 +17,11 @@
#pragma once
#include <vapours/common.hpp>
#include <vapours/assert.hpp>
#include <vapours/util/util_bitutil.hpp>
namespace ams::util {
/* Utilities for alignment to power of two. */
template<typename T>
constexpr ALWAYS_INLINE bool IsPowerOfTwo(T value) {
using U = typename std::make_unsigned<T>::type;
return (static_cast<U>(value) & static_cast<U>(value - 1)) == 0;
}
template<typename T>
constexpr ALWAYS_INLINE T AlignUp(T value, size_t alignment) {
using U = typename std::make_unsigned<T>::type;