mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
Implement FN (lambda shortener)
Useful for some higher order functions. Allows to make short lambdas even shorter.
This commit is contained in:
parent
5c6f5a1610
commit
4b787b22c8
12 changed files with 80 additions and 72 deletions
|
|
@ -198,9 +198,7 @@ namespace utils
|
|||
#endif
|
||||
}();
|
||||
|
||||
ensure(r > 0 && r <= 0x10000);
|
||||
|
||||
return r;
|
||||
return ensure(r, FN(((x & (x - 1)) == 0 && x > 0 && x <= 0x10000)));
|
||||
}
|
||||
|
||||
// Convert memory protection (internal)
|
||||
|
|
@ -607,8 +605,7 @@ namespace utils
|
|||
if (const char c = fs::file("/proc/sys/vm/overcommit_memory").read<char>(); c == '0' || c == '1')
|
||||
{
|
||||
// Simply use memfd for overcommit memory
|
||||
m_file = ::memfd_create_("", 0);
|
||||
ensure(m_file >= 0);
|
||||
m_file = ensure(::memfd_create_("", 0), FN(x >= 0));
|
||||
ensure(::ftruncate(m_file, m_size) >= 0);
|
||||
return;
|
||||
}
|
||||
|
|
@ -634,8 +631,7 @@ namespace utils
|
|||
if ((vm_overcommit & 3) == 0)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
m_file = ::memfd_create_("", 0);
|
||||
ensure(m_file >= 0);
|
||||
m_file = ensure(::memfd_create_("", 0), FN(x >= 0));
|
||||
#else
|
||||
const std::string name = "/rpcs3-mem2-" + std::to_string(reinterpret_cast<u64>(this));
|
||||
|
||||
|
|
@ -827,7 +823,7 @@ namespace utils
|
|||
{
|
||||
// TODO: Implement it
|
||||
}
|
||||
|
||||
|
||||
if (MapViewOfFile3(m_handle, GetCurrentProcess(), target, 0, m_size, MEM_REPLACE_PLACEHOLDER, PAGE_EXECUTE_READWRITE, nullptr, 0))
|
||||
{
|
||||
if (prot != protection::rw && prot != protection::wx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue