Skip to content

Commit 19dd2d7

Browse files
committed
Merge commit '7b24b42711287733b1f8732ecb22b85068c107f4' of https://github.com/shadps4-emu/shadPS4 into rb4-test3
2 parents ddadb69 + 7b24b42 commit 19dd2d7

30 files changed

+4862
-4856
lines changed

src/common/div_ceil.h

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
2-
// SPDX-License-Identifier: GPL-2.0-or-later
3-
4-
#pragma once
5-
6-
#include <cstddef>
7-
#include <type_traits>
8-
9-
namespace Common {
10-
11-
/// Ceiled integer division.
12-
template <typename N, typename D>
13-
requires std::is_integral_v<N> && std::is_unsigned_v<D>
14-
[[nodiscard]] constexpr N DivCeil(N number, D divisor) {
15-
return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor);
16-
}
17-
18-
/// Ceiled integer division with logarithmic divisor in base 2
19-
template <typename N, typename D>
20-
requires std::is_integral_v<N> && std::is_unsigned_v<D>
21-
[[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) {
22-
return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2);
23-
}
24-
25-
} // namespace Common
1+
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#include <cstddef>
7+
#include <type_traits>
8+
9+
namespace Common {
10+
11+
/// Ceiled integer division.
12+
template <typename N, typename D>
13+
requires std::is_integral_v<N> && std::is_unsigned_v<D>
14+
[[nodiscard]] constexpr N DivCeil(N number, D divisor) {
15+
return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor);
16+
}
17+
18+
/// Ceiled integer division with logarithmic divisor in base 2
19+
template <typename N, typename D>
20+
requires std::is_integral_v<N> && std::is_unsigned_v<D>
21+
[[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) {
22+
return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2);
23+
}
24+
25+
} // namespace Common

src/common/ntapi.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2-
// SPDX-License-Identifier: GPL-2.0-or-later
3-
4-
#ifdef _WIN32
5-
6-
#include "ntapi.h"
7-
8-
NtClose_t NtClose = nullptr;
9-
NtSetInformationFile_t NtSetInformationFile = nullptr;
10-
NtCreateThread_t NtCreateThread = nullptr;
11-
NtTerminateThread_t NtTerminateThread = nullptr;
12-
NtQueueApcThreadEx_t NtQueueApcThreadEx = nullptr;
13-
14-
namespace Common::NtApi {
15-
16-
void Initialize() {
17-
HMODULE nt_handle = GetModuleHandleA("ntdll.dll");
18-
19-
// http://stackoverflow.com/a/31411628/4725495
20-
NtClose = (NtClose_t)GetProcAddress(nt_handle, "NtClose");
21-
NtSetInformationFile =
22-
(NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile");
23-
NtCreateThread = (NtCreateThread_t)GetProcAddress(nt_handle, "NtCreateThread");
24-
NtTerminateThread = (NtTerminateThread_t)GetProcAddress(nt_handle, "NtTerminateThread");
25-
NtQueueApcThreadEx = (NtQueueApcThreadEx_t)GetProcAddress(nt_handle, "NtQueueApcThreadEx");
26-
}
27-
28-
} // namespace Common::NtApi
29-
30-
#endif
1+
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#ifdef _WIN32
5+
6+
#include "ntapi.h"
7+
8+
NtClose_t NtClose = nullptr;
9+
NtSetInformationFile_t NtSetInformationFile = nullptr;
10+
NtCreateThread_t NtCreateThread = nullptr;
11+
NtTerminateThread_t NtTerminateThread = nullptr;
12+
NtQueueApcThreadEx_t NtQueueApcThreadEx = nullptr;
13+
14+
namespace Common::NtApi {
15+
16+
void Initialize() {
17+
HMODULE nt_handle = GetModuleHandleA("ntdll.dll");
18+
19+
// http://stackoverflow.com/a/31411628/4725495
20+
NtClose = (NtClose_t)GetProcAddress(nt_handle, "NtClose");
21+
NtSetInformationFile =
22+
(NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile");
23+
NtCreateThread = (NtCreateThread_t)GetProcAddress(nt_handle, "NtCreateThread");
24+
NtTerminateThread = (NtTerminateThread_t)GetProcAddress(nt_handle, "NtTerminateThread");
25+
NtQueueApcThreadEx = (NtQueueApcThreadEx_t)GetProcAddress(nt_handle, "NtQueueApcThreadEx");
26+
}
27+
28+
} // namespace Common::NtApi
29+
30+
#endif

0 commit comments

Comments
 (0)