Commit graph

33 commits

Author SHA1 Message Date
Pokechu22
78e43a4404 Make all custom fmt::formatter's format functions const
fmt 8.0.0 requires this.
2022-01-13 11:11:08 -08:00
Pokechu22
d2041b4c2a VideoCommon: Add signed version of BitfieldExtract 2021-11-17 20:04:33 -08:00
Pierre Bourdon
e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Shawn Hoffman
4ce22c093c msvc: remove workarounds for old compiler issues 2021-06-03 18:33:24 -07:00
Pokechu22
0f7c9ef767 Change BitfieldExtract to use a pointer to the bitfield member 2021-05-07 15:11:17 -07:00
Pokechu22
f697e17dd1 Create BitFieldArray 2021-03-06 17:34:03 -08:00
Pokechu22
1273c5e395 Add fmt support to BitField 2021-03-06 14:58:32 -08:00
Pokechu22
cf95deaf6d Allow specifying StorageType for BitField
This is useful for BitFields that are bools.
2021-03-06 14:57:44 -08:00
JosJuice
2137fb7813 Externals: Add zstd
I had to rename Source/Common/Compiler.h because the VS build
confuses it with Externals/zstd/lib/common/compiler.h otherwise.
2020-05-13 20:53:10 +02:00
Lioncash
3f210836ad Compiler: Rename __forceinline define to DOLPHIN_FORCE_INLINE
This is much better as prefixed double underscores are reserved for the
implementation when it comes to identifiers. Another reason its better,
is that, on Windows, where __forceinline is a compiler built-in, with
the previous define, header inclusion software that detects unnecessary
includes will erroneously flag usages of Compiler.h as unnecessary
(despite being necessary on other platforms). So we define a macro
that's used by Windows and other platforms to ensure this doesn't
happen.
2018-06-09 12:20:25 -04:00
Lioncash
03414e8e84 Common: Add header for compiler-specifics
Instead of globbing things under an ambiguous Common.h header, move
compiler-specifics over to Compiler.h. This gives us a dedicated home
for anything related to compilers that we want to make functional across
all compilers that we support.

This moves us a little closer to eliminating Common.h entirely.
2018-06-09 12:10:05 -04:00
spycrab
40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
JosJuice
983b986303 Don't delete BitField copy assignment operator on VS 2017-11-13 19:51:11 +01:00
Stenzek
4d36f0cc87 Bitfield: Cast value to storage type in assignment operator
This allows us to use enum classes in bitfields.
2017-09-11 19:40:25 +10:00
Lioncash
696e1b40b5 Common: Move version strings to their own header
Ideally Common.h wouldn't be a header in the Common library, and instead be renamed to something else, like PlatformCompatibility.h or something, but even then, there's still some things in the header that don't really fall under that label

This moves the version strings out to their own version header that doesn't dump a bunch of other unrelated things into scope, like what Common.h was doing.

This also places them into the Common namespace, as opposed to letting them sit in the global namespace.
2017-09-09 19:28:10 -04:00
Stenzek
416afa065c BitField: Add StartBit() and NumBits() accessors 2017-07-30 12:38:49 +10:00
Lioncash
b711daee5f BitField: Get rid of a C-style cast
This can simply be the max value of the unsigned type.
2017-03-23 15:28:58 -04:00
Lioncash
e43c495ce5 BitField: Convert typedefs to using aliases 2017-03-23 15:28:50 -04:00
Lioncash
caef08988e BitField: Make mostly constexpr capable
Makes the constructor and retrieval functions constexpr.
2017-03-23 11:45:45 -04:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
shuffle2
0fdaacc7e0 Merge pull request #2738 from lioncash/bitfield
Common: Fix BitField mask generation.
2015-10-03 18:21:24 -07:00
Lioncash
102a2a975d BitField: Enable ifdef'd out code for Windows 2015-09-03 22:06:15 -04:00
Yuri Kunde Schlesner
5c264281eb Common: Remove redundant masking in BitField
For the signed case, the shifts already remove the rest of the value, so ANDing by the mask is redundant.
2015-07-11 22:30:01 -04:00
Yuri Kunde Schlesner
c334a6ca65 Common: Fix mask generation in BitField 2015-07-11 22:28:09 -04:00
Tillmann Karras
cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Stevoisiak
93b16a4a2d Formatting/Whitespace Cleanup
Various fixes to formatting and whitespace
2015-02-25 10:48:21 -05:00
magumagu
3aa3002010 Fix Intellisense error spam on Visual Studio.
Intellisense doesn't like defines in PCH files, and it doesn't like the deleted
constructor for BitField.  (I think it's being overly strict about the
"must have no non-default constructors" rule for classes in unions.)
2015-01-23 19:15:25 -08:00
Lioncash
c0c835d0b6 BitField: Fix a typo in the sample usage. 2014-10-24 13:33:02 -04:00
Tony Wasserka
3d6f9ef897 BitField: Add an explicit getter function for retrieving the BitField value.
Sometimes (in particular when using non-typesafe functions) it can be convenient to have a getter method rather than performing a potentially lengthy explicit cast.
2014-06-11 20:58:40 +02:00
Tony Wasserka
b3c7f003da BitField: Delete copy assignment to prevent obscure bugs. 2014-06-11 20:58:40 +02:00
Tony Wasserka
ccc04944b2 BitField: Fix alignment issues.
At least one platform (ARM with NEON instructions enabled) generates SIGBUSes if BitField objects aren't aligned properly.
2014-04-14 20:04:44 +02:00
Tony Wasserka
12841928df BitField: Optimize generated assembly by forcing inlining. 2014-04-13 13:27:01 +02:00
Tony Wasserka
48a1790d81 Common: Add a generic class for accessing bitfields in a fast and endianness-independent way.
The underlying storage type of a bitfield can be any intrinsic integer type,
but also any enumeration.

Custom storage types are supported if the following things are defined on the storage type:
- casting 0 to the storage type
- bit shift operators (in both directions)
- bitwise & operator
- bitwise ~ operator
- std::make_unsigned specialization
2014-03-25 23:33:04 +01:00