1
0
Fork 0
forked from suyu/suyu
suyu/src
Lioncash b879fb84a2 svc: Correct always true assertion case in SetThreadCoreMask
The reason this would never be true is that ideal_processor is a u8 and
THREADPROCESSORID_DEFAULT is an s32. In this case, it boils down to how
arithmetic conversions are performed before performing the comparison.

If an unsigned value has a lesser conversion rank (aka smaller size)
than the signed type being compared, then the unsigned value is promoted
to the signed value (i.e. u8 -> s32 happens before the comparison). No
sign-extension occurs here either.

An alternative phrasing:

Say we have a variable named core and it's given a value of -2.

u8 core = -2;

This becomes 254 due to the lack of sign. During integral promotion to
the signed type, this still remains as 254, and therefore the condition
will always be true, because no matter what value the u8 is given it
will never be -2 in terms of 32 bits.

Now, if one type was a s32 and one was a u32, this would be entirely
different, since they have the same bit width (and the signed type would
be converted to unsigned instead of the other way around) but would
still have its representation preserved in terms of bits, allowing the
comparison to be false in some cases, as opposed to being true all the
time.

---

We also get rid of two signed/unsigned comparison warnings while we're
at it.
2018-07-19 15:46:17 -04:00
..
common Merge pull request #709 from lioncash/thread-local 2018-07-19 10:00:48 -07:00
core svc: Correct always true assertion case in SetThreadCoreMask 2018-07-19 15:46:17 -04:00
input_common Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
tests Virtual Filesystem 2: Electric Boogaloo (#676) 2018-07-18 18:07:11 -07:00
video_core gl_state: Temporarily disable culling and depth test. 2018-07-18 23:21:43 -04:00
yuzu Merge pull request #684 from lioncash/nonmember 2018-07-18 18:55:00 -07:00
yuzu_cmd settings: Turn docked mode off by default. 2018-07-17 22:52:25 -04:00
.clang-format Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07:00
CMakeLists.txt Massive removal of unused modules 2018-01-12 19:11:03 -07:00