aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/nca.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-19 14:36:22 -0400
committerLioncash <mathew1800@gmail.com>2018-07-19 15:46:17 -0400
commit9ee475f7316ad5ae59baf8277ad31a06bfe0a8b3 (patch)
tree03406880371a04075cfa3ebfc6f2912af476d39e /src/core/loader/nca.cpp
parentb2d1d18681959a0445b4c0afe4baf2fb53ba6ed1 (diff)
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.
Diffstat (limited to 'src/core/loader/nca.cpp')
0 files changed, 0 insertions, 0 deletions