yuzu/src/core/hle
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
..
kernel svc: Correct always true assertion case in SetThreadCoreMask 2018-07-19 15:46:17 -04:00
service Merge pull request #691 from lioncash/guard 2018-07-18 19:46:14 -07:00
config_mem.cpp Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
config_mem.h Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
ipc.h add IPC CommandType & Some HID FunctionInfo (#487) 2018-05-30 14:09:21 -04:00
ipc_helpers.h ipc: Add support for PopIpcInterface() method. 2018-05-01 21:57:44 -04:00
lock.cpp Fix build on macOS and linux 2018-01-13 22:38:52 +00:00
lock.h Use recursive_mutex instead of mutex to fix #2902 2017-08-29 20:39:55 +12:00
result.h Add & correct some error modules 2018-05-23 14:22:42 +02:00
romfs.cpp apt: load shared font from system archive 2017-06-26 01:38:12 +03:00
romfs.h apt: load shared font from system archive 2017-06-26 01:38:12 +03:00
shared_page.cpp core_timing: Namespace all functions and constants in core_timing's header 2018-04-30 03:32:59 -04:00
shared_page.h Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00