[subrepo]
remote = https://github.com/pcercuei/lightrec.git
branch = master
- commit = a8fe7568cef718517b230a13fe48891faa60f04b
- parent = 2f609094ad9ec14212fb730897ccb63f2f44bc40
+ commit = 30bad28d7a2b2903cd7f3d8024ae7a34a0c8b482
+ parent = 0141267e1c5e17c27548f6ad57c7acc22e589990
method = merge
cmdver = 0.4.3
return val < min ? min : val > max ? max : val;
}
+static u16 load_u16(u32 *ptr)
+{
+ return ((struct u16x2 *) ptr)->l;
+}
+
+static void store_u16(u32 *ptr, u16 value)
+{
+ ((struct u16x2 *) ptr)->l = value;
+}
+
static u32 lightrec_mfc2(struct lightrec_state *state, u8 reg)
{
s16 gteir1, gteir2, gteir3;
case 9:
case 10:
case 11:
- return (s32)(s16) state->regs.cp2d[reg];
+ return (s32)(s16) load_u16(&state->regs.cp2d[reg]);
case 7:
case 16:
case 17:
case 18:
case 19:
- return (u16) state->regs.cp2d[reg];
+ return load_u16(&state->regs.cp2d[reg]);
case 28:
case 29:
- gteir1 = (s16) state->regs.cp2d[9];
- gteir2 = (s16) state->regs.cp2d[10];
- gteir3 = (s16) state->regs.cp2d[11];
+ gteir1 = (s16) load_u16(&state->regs.cp2d[9]);
+ gteir2 = (s16) load_u16(&state->regs.cp2d[10]);
+ gteir3 = (s16) load_u16(&state->regs.cp2d[11]);
return clamp_s32(gteir1 >> 7, 0, 0x1f) << 0 |
clamp_s32(gteir2 >> 7, 0, 0x1f) << 5 |
case 27:
case 29:
case 30:
- data = (s32)(s16) data;
+ store_u16(&state->regs.cp2c[reg], data);
break;
case 31:
data = (data & 0x7ffff000) | !!(data & 0x7f87e000) << 31;
fallthrough;
default:
+ state->regs.cp2c[reg] = data;
break;
}
-
- state->regs.cp2c[reg] = data;
}
void lightrec_mtc(struct lightrec_state *state, union code op, u32 data)
static unsigned int get_processors_count(void)
{
- unsigned int nb;
+ unsigned int nb = 1;
#if defined(PTW32_VERSION)
nb = pthread_num_processors_np();
size_t size = sizeof(count);
nb = sysctlbyname("hw.ncpu", &count, &size, NULL, 0) ? 1 : count;
-#elif defined(__linux__)
+#elif defined(_SC_NPROCESSORS_ONLN)
nb = sysconf(_SC_NPROCESSORS_ONLN);
#endif