Commit Graph

69 Commits

Author SHA1 Message Date
Michael M b58f8d19ab Rename Common::FifoQueue to Common::SPSCQueue
Since all queues are FIFO data structures, the name wasn't informative
as to why you'd use it over a normal queue. I originally thought it had
something to do with the hardware graphics FIFO.

This renames it using the common acronym SPSC, which stands for
single-producer single-consumer, and is most commonly used to talk about
lock-free data structures, both of which this is.
2017-08-23 17:00:52 -07:00
Michael M 7d791cb6f6 BitUtilsTest: update to pass clang-format 2017-08-13 19:04:56 -07:00
Niels Boehm df82adca43 Add function testing whether a bitmask is valid.
This one verifies bitmasks where low bits are set to 1 (hence the name).
Any stray 0 among the lower ones or any stray 1 among the higher zeros
renders the mask invalid.

The edge cases of all zeros and all ones are considered valid masks.

It uses an efficient implementation. It's the counterpart of
https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
2017-06-22 20:22:53 +02:00
Sepalani 5fb26abb17 StringUtil: Add StringPopBackIf UnitTests 2017-06-06 05:50:45 +01:00
Léo Lam d9fd056803 Fix minor formatting issues
These were not caught by the lint script while it was broken.
2017-06-05 02:32:19 +02:00
spycrab e66ad018f4 Convert VolumeDirectory names back to SHIFT-JIS (issue #9988) 2017-05-01 14:08:47 +02:00
Matthew Parlane e05b6cf3f4 Merge pull request #5155 from ligfx/expecttruefalse
UnitTests: use EXPECT_TRUE/EXPECT_FALSE (fixes warnings)
2017-03-26 14:53:17 +13:00
Michael Maltese 04db3d5a50 UnitTests: use EXPECT_TRUE/EXPECT_FALSE (fixes warnings)
Using `EXPECT_EQ` with boolean literals can cause a warning in certain
versions of GCC. See https://github.com/google/googletest/issues/322

Fixes warnings:

```
../Source/UnitTests/Common/BitSetTest.cpp: In member function 'virtual void BitSet_Basics_Test::TestBody()':
../Source/UnitTests/Common/BitSetTest.cpp:15:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/BitSetTest.cpp: In member function 'virtual void BitSet_BitGetSet_Test::TestBody()':
../Source/UnitTests/Common/BitSetTest.cpp:27:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp: In member function 'virtual void StringUtil_StringBeginsWith_Test::TestBody()':
../Source/UnitTests/Common/StringUtilTest.cpp:23:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:25:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:26:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:27:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp: In member function 'virtual void StringUtil_StringEndsWith_Test::TestBody()':
../Source/UnitTests/Common/StringUtilTest.cpp:35:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:37:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:38:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:39:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
c
```
2017-03-24 17:26:27 -07:00
Michael Maltese 9234ed82da BitUtilsTest: compare ints of the same signedness (fixes warnings)
Fixes warnings like:

```
dolphin/Source/UnitTests/Common/BitUtilsTest.cpp:5:
../Externals/gtest/googletest/include/gtest/gtest.h:1392:11: warning: comparison of integers of different signs: 'const unsigned long' and 'const int' [-Wsign-compare]
  if (lhs == rhs) {
      ~~~ ^  ~~~
../Externals/gtest/googletest/include/gtest/gtest.h:1421:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned long, int>' requested here
    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
           ^
dolphin/Source/UnitTests/Common/BitUtilsTest.cpp:12:3: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
  EXPECT_EQ(Common::BitSize<s8>(),  8);
  ^
../Externals/gtest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
                      EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
```
2017-03-24 17:15:37 -07:00
Lioncash 552c0d8404 Common: Move byte swapping utilities into their own header
This moves all the byte swapping utilities into a header named Swap.h.

A dedicated header is much more preferable here due to the size of the
code itself. In general usage throughout the codebase, CommonFuncs.h was
generally only included for these functions anyway. These being in their
own header avoids dumping the lesser used utilities into scope. As well
as providing a localized area for more utilities related to byte
swapping in the future (should they be needed). This also makes it nicer
to identify which files depend on the byte swapping utilities in
particular.

Since this is a completely new header, moving the code uncovered a few
indirect includes, as well as making some other inclusions unnecessary.
2017-03-03 17:18:18 -05:00
Lioncash 0a6f0dfb74 Common: Add bit utility header
This attempts to make some bit arithmetic more self-documenting and also
make it easier during review to identify potential off-by-one errors by
making it possible to just specify which bits are being extracted.

Functions both support the case where bits being extracted can vary and
fixed bit extraction. In the case the bits are fixed, compile-time asserts
are present to prevent accidental API usage at compile-time.

e.g. Instead of shifting and masking to get bits 10 to 15,
Common::ExtractBits<10, 15>(value) can just be done instead.
2017-01-14 11:16:02 -05:00
BhaaL 23d99f2f2c specify custom brace style to fix unions
BreakBeforeBraces: Allman apparently includes all styles,
except for AfterUnion (which is false) when using clang-format -dump-config
2017-01-05 12:55:13 +01:00
Sepalani a6114bad34 Import/Export signature files as CSV 2016-12-18 00:27:10 +00:00
JosJuice 0c6fd47460 Add unit test for StringUtil's newly added JoinStrings 2016-11-27 22:11:14 +01:00
JosJuice 841e5893f4 IOS HLE: Add unit test for path/filename escaping 2016-11-27 22:11:05 +01:00
degasus 3b3cbc4aab BusyLoopTest: Only run 10 times.
Running this test 100 times is not worth to spend 1 second.
2016-06-27 22:06:52 +02:00
Pierre Bourdon a910a4309f x64EmitterTest: fill cpu_info with 0x01 instead of 0xFF to make gcc happier 2016-06-27 01:55:42 +02:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Lioncash 8d9221a71e MathUtilTest: Fix tests on MSVC - Document compiler bug
MSVC's implementation of numeric_limits currently generates incorrect
signaling NaNs. The resulting values are actually quiet NaNs instead.

This commit is based off of a solution by shuffle2. The only
difference is a template specialization for floats is also added
to cover all bases
2016-04-03 19:16:47 -04:00
Lioncash 8ce04f9a65 General: Replace GC_ALIGN macros with alignas
Standard supported alignment -> out with compiler-specific.
2015-09-06 12:53:51 -04:00
Lioncash 3f1b488a12 CommonFuncs: Replace ArraySize define with constexpr equivalent 2015-09-03 23:47:14 -04:00
Lioncash caec42135d MathUtil: Remove IsNAN and IsINF
These aren't necessary, since the stdlib provides equivalents.
2015-08-21 15:05:43 -04:00
Tillmann Karras 439fb26b9b x64Emitter: add MOVSLDUP/MOVSHDUP 2015-08-06 10:39:43 +02:00
Matthew Parlane f32cede086 Revert "x64: build a Position-Independent Executable (PIE)" 2015-06-14 16:06:26 +12:00
flacs d3e47dfcf5 Merge pull request #2496 from Tilka/fma4
Jit64: add FMA4 support to fmaddXX
2015-06-06 17:31:55 +02:00
Tillmann Karras d4538c762f MemoryUtil: get executable pages near static data
and clean up a bit.
2015-06-03 21:44:31 +02:00
Tillmann Karras 8db6588bb9 XEmitter: add FMA4 instructions 2015-06-02 19:19:52 +02:00
degasus 9c730b0a1f Unittests: Add BlockingLoopTest 2015-05-30 13:40:36 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Fiora 22317ac74c Merge pull request #2417 from Tilka/vex
XEmitter: VEX-related cleanup

I'm merging this solely because of the FMA3 error message
2015-05-18 16:23:23 -07:00
Tillmann Karras c2c31086ae XEmitter: restructure WriteVEXOp wrappers 2015-05-17 18:44:56 +02:00
yerejm e4e1fe5a9c Reset faked CPU extension support at test end to ensure test isolation. 2015-05-17 11:48:05 +10:00
Tillmann Karras 9793fed742 XEmitter: add PUNPCKLQDQ 2015-03-18 12:09:06 +01:00
Tillmann Karras b0bde31ac0 Fix include order of files outside of Source/Core 2015-03-01 14:54:22 +01:00
Tillmann Karras eb13aa43fe XEmitter: overload MOVBE() 2015-01-18 12:59:33 +01:00
Tillmann Karras 1efa9b8b72 x64Emitter: add MOVLPS/MOVHPS 2015-01-07 11:23:52 +01:00
Tillmann Karras 3daa6ab259 x64Emitter: fix MOVLPD/MOVHPD
These instructions were using the wrong prefix which turned
MOVLPD(reg, mem) into MOVDDUP(reg, mem) and made the rest of them
invalid.
2015-01-07 11:23:52 +01:00
Tillmann Karras 791d5458e5 UnitTests: add tests for bitwise AVX instructions 2014-12-06 22:28:03 +01:00
Tillmann Karras ddebdb61c4 UnitTests: fix register symbol name in AVX tests 2014-12-06 22:28:03 +01:00
comex c81e3da22f Add unit test. 2014-10-25 16:57:25 -04:00
Fiora 4289221584 X64Emitter: add unit test for FMA 2014-10-07 18:21:07 -07:00
Ryan Houdek 4e16abd742 Merge pull request #1083 from FioraAeterna/lzcnt
Add LZCNT support, use in cntlzw
2014-09-14 09:18:10 -05:00
Fiora 997c5c2d0e x64Emitter: add LZCNT/TZCNT support and detection
Also add a unit test.
2014-09-14 05:31:22 -07:00
Lioncash 068799ff73 UnitTests: Fix misplaced braces in the x64Emitter tests 2014-09-13 20:45:17 -04:00
Fiora 1bd8d1ee98 Add immediate tests for WriteNormalOp
also fix a bug in Bochs that was preventing adc from passing.
2014-09-13 16:39:34 -07:00
Fiora 94c20db369 Rename Log2 and add IsPow2 to MathUtils for future use
Also remove unused pow2/pow2f functions.
2014-09-08 20:15:45 -07:00
Fiora 07e0c917c6 Revert "JIT64: optimize CA calculations" 2014-09-05 10:26:30 -07:00
comex 97420c6ec6 Merge pull request #852 from FioraAeterna/optimizeca
JIT64: optimize CA calculations
2014-09-05 11:52:02 -04:00
Fiora 5088a2b4e2 x64Emitter: add BMI1/BMI2 support
TZCNT and LZCNT use a completely different encoding scheme, so they should
probably go in a separate patch.

Also add some tests.
2014-09-03 10:04:01 -07:00
Pierre Bourdon cee71afce5 x64EmitterTest: Fake support for all CPU extensions 2014-09-03 02:26:11 +02:00