summaryrefslogtreecommitdiff
path: root/src/common/common_funcs.h
AgeCommit message (Collapse)Author
2021-09-13common_funcs: Add enum flag bitwise shift operator overloadsMorph
This adds bitwise shift operator overloads (<<, >>, <<=, >>=) in the macro DECLARE_ENUM_FLAG_OPERATORS(type)
2021-09-11common_funcs: Replace <algorithm> with <iterator>Morph
2021-09-11common: Move error handling to error.cpp/hMorph
This allows us to avoid implicitly including <string> every time common_funcs.h is included.
2021-05-31common_funcs: Move R_ macros to result.hLioncash
These macros all interact with the result code type, so they should ideally be within this file as well, so all the common_funcs machinery doesn't need to be pulled in just to use them.
2021-05-05common: Rename NON_COPYABLE/NON_MOVABLE with YUZU_ prefix.bunnei
2021-05-05common: common_funcs: Add Size helper function.bunnei
2021-05-05common: common_funcs: Add helper macros for non-copyable and non-moveable.bunnei
- Useful for scenarios where we do not want to inherit from NonCopyable.
2021-02-28[network] Error handling reformcomex
`network.cpp` has several error paths which either: - report "Unhandled host socket error=n" and return `SUCCESS`, or - switch on a few possible errors, log them, and translate them to Errno; the same switch statement is copied and pasted in multiple places in the code Convert these paths to use a helper function `GetAndLogLastError`, which is roughly the equivalent of one of the switch statements, but: - handling more cases (both ones that were already in `Errno`, and a few more I added), and - using OS functions to convert the error to a string when logging, so it'll describe the error even if it's not one of the ones in the switch statement. - To handle this, refactor the logic in `GetLastErrorMsg` to expose a new function `NativeErrorToString` which takes the error number explicitly as an argument. And improve the Windows version a bit. Also, add a test which exercises two random error paths.
2021-01-28common: common_funcs: Change R_UNLESS to LOG_ERROR.bunnei
2021-01-28common: common_funcs: Log error on R_UNLESS.bunnei
2021-01-28common: common_funcs: Add useful kernel macro R_SUCCEED_IF.bunnei
2021-01-28common: common_funcs: Add a few more useful macros for kernel code.bunnei
2021-01-15common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINITReinUsesLisp
INSERT_PADDING_BYTES_NOINIT is more descriptive of the underlying behavior.
2021-01-11common: common_funcs: Add R_UNLESS macro.bunnei
2020-08-24common_funcs: Add missing XOR operators to DECLARE_ENUM_FLAG_OPERATORSLioncash
Ensures that the full set of bitwise operators are available for types that make use of this macro.
2020-08-15common: Make use of [[nodiscard]] where applicableLioncash
Now that clang-format makes [[nodiscard]] attributes format sensibly, we can apply them to several functions within the common library to allow the compiler to complain about any misuses of the functions.
2020-04-17common: common_funcs: Add a macro for defining enum flag operators.bunnei
2019-11-14common_funcs: Remove semicolons from INSERT_PADDING_* macrosLioncash
Makes code that uses the macros consistent by requiring the lines to be terminated with a semicolon.
2019-11-13common_funcs: silence sign-conversion warnings in MakeMagic()Lioncash
We can trivially resolve these by casting the characters to unsigned values and then shifting the bits.
2019-11-03common_func: Use std::array for INSERT_PADDING_* macros.bunnei
- Zero initialization here is useful for determinism.
2019-11-03Revert "common_func: Use std::array for INSERT_PADDING_* macros."bunnei
2019-11-03common_func: Use std::array for INSERT_PADDING_* macros.bunnei
- Zero initialization here is useful for determinism.
2019-07-05texture_cache: Address FeedbackFernando Sahmkow
2019-06-20Reduce amount of size calculations.Fernando Sahmkow
2018-07-29Port #3732 from Citra: "common: Fix compilation on ARM"Cameron Cawley
2018-07-19Merge pull request #710 from lioncash/unusedbunnei
common/common_funcs: Remove unused rotation functions
2018-07-19common/common_funcs: Remove unused rotation functionsLioncash
These are unused and essentially don't provide much benefit either. If we ever need rotation functions, these can be introduced in a way that they don't sit in a common_* header and require a bunch of ifdefing to simply be available
2018-07-19common/misc: Deduplicate code in GetLastErrorMsg()Lioncash
Android and macOS have supported thread_local for quite a while, but most importantly is that we don't even really need it. Instead of using a thread-local buffer, we can just return a non-static buffer as a std::string, avoiding the need for that quality entirely.
2018-07-07Port #3579 from CitrafearlessTobi
2018-04-20Merge pull request #362 from lioncash/snprintfbunnei
common_funcs: Remove check for VS versions that we don't even support
2018-04-19common_funcs: Remove ARRAY_SIZE macroLioncash
C++17 has non-member size() which we can just call where necessary.
2018-04-19common_funcs: Remove check for VS versions that we don't even supportLioncash
We don't support any VS versions that don't already have snprintf in the standard library implementation.
2017-10-15core: Refactor MakeMagic usage and remove dead code.bunnei
2017-05-27Common: Fix some out-of-style includesYuri Kunde Schlesner
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-18Manually tweak source formatting and then re-run clang-formatYuri Kunde Schlesner
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot
2016-05-27common_funcs: Provide rotr and rotl for MSVCMerryMage
2016-04-30VideoCore: Run include-what-you-use and fix most includes.Emmanuel Gil Peyrot
2016-03-09Common: Get rid of alignment macrosLioncash
The gl rasterizer already uses alignas, so we may as well move everything over.
2015-08-17Fix building under MinGWdarkf
2015-08-15Rename ARCHITECTURE_X64 definition to ARCHITECTURE_x86_64.bunnei
2015-08-15x64: Refactor to remove fake interfaces and general cleanups.bunnei
2015-08-15Common: Ported over boilerplate x86 JIT code from Dolphin/PPSSPP.bunnei
2015-08-11Stop defining GCC always_inline attributes as __forceinlinearchshift
__forceinline is a MSVC extension, which may confuse some people working on the codebase. Furthermore, the C++ standard dictates that all names which contain adjacent underscores are reserved.
2015-07-12don“t define snprintf on Visual Studio 2015Apology11
Visual Studio 2015 defines this in stdio now
2015-06-28Common: Remove unused ROUND_UP_POW2 macro.Emmanuel Gil Peyrot
2015-06-28Common: Cleanup memory and misc includes.Emmanuel Gil Peyrot
2015-05-09Common: Remove the BIT macroYuri Kunde Schlesner
When the macro was introduced in 326ec51261299e48de97592631c02523da9c8118 it wasn't noticed that it conflicted in name with a heavily used macro inside of dyncom. This causes some compiler warnings. Since it's only lightly used, it was opted to simply remove the new macro.
2015-05-08Common: Add BIT macroYuri Kunde Schlesner