<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dolphin/Source/UnitTests/Common/BitUtilsTest.cpp, branch release-prep-2506</title>
<subtitle>GameCube and Wii emulator</subtitle>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/'/>
<entry>
<title>Replace Common::BitCast with std::bit_cast</title>
<updated>2024-05-04T01:43:51+00:00</updated>
<author>
<name>Pokechu22</name>
<email>Pokechu022@gmail.com</email>
</author>
<published>2022-08-06T04:10:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=fbbfea8e8e536800a6a911eb90cecdd1f343f9e3'/>
<id>fbbfea8e8e536800a6a911eb90cecdd1f343f9e3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace BitUtils with C++20: RotateLeft/RotateRight</title>
<updated>2022-12-11T07:59:18+00:00</updated>
<author>
<name>JosJuice</name>
<email>josjuice@gmail.com</email>
</author>
<published>2022-08-05T13:39:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=454537d53efd0579d4cd2a48108f3bdb490b08d2'/>
<id>454537d53efd0579d4cd2a48108f3bdb490b08d2</id>
<content type='text'>
Now that we've flipped the C++20 switch, let's start making use of
the nice new &lt;bit&gt; header.

I'm planning on handling this move away from BitUtils.h incrementally
in a series of PRs. There may be a few functions remaining in
BitUtils.h by the end that C++20 doesn't have any equivalents for.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we've flipped the C++20 switch, let's start making use of
the nice new &lt;bit&gt; header.

I'm planning on handling this move away from BitUtils.h incrementally
in a series of PRs. There may be a few functions remaining in
BitUtils.h by the end that C++20 doesn't have any equivalents for.
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: convert GPLv2+ license info to SPDX tags</title>
<updated>2021-07-05T02:35:56+00:00</updated>
<author>
<name>Pierre Bourdon</name>
<email>delroth@gmail.com</email>
</author>
<published>2021-07-05T01:22:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=e149ad4f0a9874f354221a7fc76d8f1841e47808'/>
<id>e149ad4f0a9874f354221a7fc76d8f1841e47808</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>UnitTests: Fix MSVC compilation</title>
<updated>2018-06-12T13:28:59+00:00</updated>
<author>
<name>spycrab</name>
<email>spycrab@users.noreply.github.com</email>
</author>
<published>2018-06-12T13:10:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=4d55cb745c4ed6bc624071dbcc8f23f37d186da6'/>
<id>4d55cb745c4ed6bc624071dbcc8f23f37d186da6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>BitUtils: Add C++14/C++17 compatible equivalent of std::bit_cast from C++2a</title>
<updated>2018-05-10T16:28:05+00:00</updated>
<author>
<name>Lioncash</name>
<email>mathew1800@gmail.com</email>
</author>
<published>2018-05-10T13:54:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=b3292298c976279765926c9927f2e4cfe38b3ede'/>
<id>b3292298c976279765926c9927f2e4cfe38b3ede</id>
<content type='text'>
Given bit conversions between types are quite common in emulation
(particularly when it comes to floating-point among other things) it
makes sense to provide a utility function that keeps all the boilerplate
contained; especially considering it makes it harder to accidentally
misuse std::memcpy (such as accidentally transposing arguments, etc).

Another benefit of this function is that it doesn't require separating
declarations from assignments, allowing variables to be declared const.
This makes the scenario of of uninitialized variables being used less
likely to occur.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Given bit conversions between types are quite common in emulation
(particularly when it comes to floating-point among other things) it
makes sense to provide a utility function that keeps all the boilerplate
contained; especially considering it makes it harder to accidentally
misuse std::memcpy (such as accidentally transposing arguments, etc).

Another benefit of this function is that it doesn't require separating
declarations from assignments, allowing variables to be declared const.
This makes the scenario of of uninitialized variables being used less
likely to occur.
</pre>
</div>
</content>
</entry>
<entry>
<title>UnitTests: Add basic tests for RotateRight() and RotateLeft()</title>
<updated>2018-03-31T22:09:50+00:00</updated>
<author>
<name>Lioncash</name>
<email>mathew1800@gmail.com</email>
</author>
<published>2018-03-31T21:30:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=136f16599f5545f1ff286ad452edee508f204564'/>
<id>136f16599f5545f1ff286ad452edee508f204564</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>BitUtilsTest: update to pass clang-format</title>
<updated>2017-08-14T02:04:56+00:00</updated>
<author>
<name>Michael M</name>
<email>mchtly@gmail.com</email>
</author>
<published>2017-08-14T02:02:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=7d791cb6f6207075ec9e4cf1e638e5c36d8113f9'/>
<id>7d791cb6f6207075ec9e4cf1e638e5c36d8113f9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add function testing whether a bitmask is valid.</title>
<updated>2017-06-22T18:22:53+00:00</updated>
<author>
<name>Niels Boehm</name>
<email>blubberdiblub@gmail.com</email>
</author>
<published>2017-06-22T10:36:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=df82adca43db7f5820a27624ae3e2b60c9085efd'/>
<id>df82adca43db7f5820a27624ae3e2b60c9085efd</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>BitUtilsTest: compare ints of the same signedness (fixes warnings)</title>
<updated>2017-03-25T00:15:37+00:00</updated>
<author>
<name>Michael Maltese</name>
<email>michaeljosephmaltese@gmail.com</email>
</author>
<published>2017-03-25T00:08:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=9234ed82daea71f5702e3bf66d4564eea50e19c6'/>
<id>9234ed82daea71f5702e3bf66d4564eea50e19c6</id>
<content type='text'>
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&lt;unsigned long, int&gt;' 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&lt;false&gt;::Compare&lt;unsigned long, int&gt;' requested here
  EXPECT_EQ(Common::BitSize&lt;s8&gt;(),  8);
  ^
../Externals/gtest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
                      EqHelper&lt;GTEST_IS_NULL_LITERAL_(val1)&gt;::Compare, \
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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&lt;unsigned long, int&gt;' 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&lt;false&gt;::Compare&lt;unsigned long, int&gt;' requested here
  EXPECT_EQ(Common::BitSize&lt;s8&gt;(),  8);
  ^
../Externals/gtest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
                      EqHelper&lt;GTEST_IS_NULL_LITERAL_(val1)&gt;::Compare, \
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Common: Add bit utility header</title>
<updated>2017-01-14T16:16:02+00:00</updated>
<author>
<name>Lioncash</name>
<email>mathew1800@gmail.com</email>
</author>
<published>2017-01-13T22:18:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/dolphin/commit/?id=0a6f0dfb74d2a5ebacd20c13452f3eb3af994417'/>
<id>0a6f0dfb74d2a5ebacd20c13452f3eb3af994417</id>
<content type='text'>
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&lt;10, 15&gt;(value) can just be done instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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&lt;10, 15&gt;(value) can just be done instead.
</pre>
</div>
</content>
</entry>
</feed>
