A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <concepts> |
| 7 | #include <iterator> |
| 8 | #include <type_traits> |
| 9 | |
| 10 | namespace Common { |
| 11 | |
| 12 | // Check if type satisfies the ContiguousContainer named requirement. |
| 13 | template <typename T> |
| 14 | concept IsContiguousContainer = std::contiguous_iterator<typename T::iterator>; |
| 15 | |
| 16 | template <typename Derived, typename Base> |
| 17 | concept DerivedFrom = std::derived_from<Derived, Base>; |
| 18 | |
| 19 | // TODO: Replace with std::convertible_to when libc++ implements it. |
| 20 | template <typename From, typename To> |
| 21 | concept ConvertibleTo = std::is_convertible_v<From, To>; |
| 22 | |
| 23 | // No equivalents in the stdlib |
| 24 | |
| 25 | template <typename T> |
| 26 | concept IsArithmetic = std::is_arithmetic_v<T>; |
| 27 | |
| 28 | template <typename T> |
| 29 | concept IsIntegral = std::is_integral_v<T>; |
| 30 | |
| 31 | } // namespace Common |
| 32 |