static inline u32 limE_(psxCP2Regs *regs, u32 result) {
if (result > 0x1ffff) {
- gteFLAG |= (1 << 31) | (1 << 17);
+ gteFLAG |= (1u << 31) | (1u << 17);
return 0x1ffff;
}
return result;
#define limE(result) \
limE_(regs,result)
-#define A1(a) BOUNDS((a), 0x7fffffff, (1 << 30), -(s64)0x80000000, (1 << 31) | (1 << 27))
-#define A2(a) BOUNDS((a), 0x7fffffff, (1 << 29), -(s64)0x80000000, (1 << 31) | (1 << 26))
-#define A3(a) BOUNDS((a), 0x7fffffff, (1 << 28), -(s64)0x80000000, (1 << 31) | (1 << 25))
-#define limB1(a, l) LIM((a), 0x7fff, -0x8000 * !l, (1 << 31) | (1 << 24))
-#define limB2(a, l) LIM((a), 0x7fff, -0x8000 * !l, (1 << 31) | (1 << 23))
-#define limB3(a, l) LIM((a), 0x7fff, -0x8000 * !l, (1 << 22))
-#define limC1(a) LIM((a), 0x00ff, 0x0000, (1 << 21))
-#define limC2(a) LIM((a), 0x00ff, 0x0000, (1 << 20))
-#define limC3(a) LIM((a), 0x00ff, 0x0000, (1 << 19))
-#define limD(a) LIM((a), 0xffff, 0x0000, (1 << 31) | (1 << 18))
-
-#define F(a) BOUNDS((a), 0x7fffffff, (1 << 31) | (1 << 16), -(s64)0x80000000, (1 << 31) | (1 << 15))
-#define limG1(a) LIM((a), 0x3ff, -0x400, (1 << 31) | (1 << 14))
-#define limG2(a) LIM((a), 0x3ff, -0x400, (1 << 31) | (1 << 13))
-#define limH(a) LIM((a), 0x1000, 0x0000, (1 << 12))
+#define A1(a) BOUNDS((a), 0x7fffffff, (1u << 30), -(s64)0x80000000, (1u << 31) | (1u << 27))
+#define A2(a) BOUNDS((a), 0x7fffffff, (1u << 29), -(s64)0x80000000, (1u << 31) | (1u << 26))
+#define A3(a) BOUNDS((a), 0x7fffffff, (1u << 28), -(s64)0x80000000, (1u << 31) | (1u << 25))
+#define limB1(a, l) LIM((a), 0x7fff, -0x8000 * !l, (1u << 31) | (1u << 24))
+#define limB2(a, l) LIM((a), 0x7fff, -0x8000 * !l, (1u << 31) | (1u << 23))
+#define limB3(a, l) LIM((a), 0x7fff, -0x8000 * !l, (1u << 22))
+#define limC1(a) LIM((a), 0x00ff, 0x0000, (1u << 21))
+#define limC2(a) LIM((a), 0x00ff, 0x0000, (1u << 20))
+#define limC3(a) LIM((a), 0x00ff, 0x0000, (1u << 19))
+#define limD(a) LIM((a), 0xffff, 0x0000, (1u << 31) | (1u << 18))
+
+#define F(a) BOUNDS((a), 0x7fffffff, (1u << 31) | (1u << 16), -(s64)0x80000000, (1u << 31) | (1u << 15))
+#define limG1(a) LIM((a), 0x3ff, -0x400, (1u << 31) | (1u << 14))
+#define limG2(a) LIM((a), 0x3ff, -0x400, (1u << 31) | (1u << 13))
+#define limH(a) LIM((a), 0x1000, 0x0000, (1u << 12))
#ifndef __arm__
#define A1U A1
a = gteLZCS;
if (a > 0) {
int i;
- for (i = 31; (a & (1 << i)) == 0 && i >= 0; i--);
+ for (i = 31; (a & (1u << i)) == 0 && i >= 0; i--);
gteLZCR = 31 - i;
} else if (a < 0) {
int i;
a ^= 0xffffffff;
- for (i = 31; (a & (1 << i)) == 0 && i >= 0; i--);
+ for (i = 31; (a & (1u << i)) == 0 && i >= 0; i--);
gteLZCR = 31 - i;
} else {
gteLZCR = 32;
#define HW_DMA_PCR (psxHu32ref(0x10f0))
#define HW_DMA_ICR (psxHu32ref(0x10f4))
-#define HW_DMA_ICR_BUS_ERROR (1<<15)
-#define HW_DMA_ICR_GLOBAL_ENABLE (1<<23)
-#define HW_DMA_ICR_IRQ_SENT (1<<31)
+#define HW_DMA_ICR_BUS_ERROR (1u << 15)
+#define HW_DMA_ICR_GLOBAL_ENABLE (1u << 23)
+#define HW_DMA_ICR_IRQ_SENT (1u << 31)
#define DMA_INTERRUPT(n) { \
u32 icr = SWAPu32(HW_DMA_ICR); \
- if (icr & (1 << (16 + n))) { \
- icr |= 1 << (24 + n); \
+ if (icr & (1u << (16 + n))) { \
+ icr |= 1u << (24 + n); \
if (icr & HW_DMA_ICR_GLOBAL_ENABLE && !(icr & HW_DMA_ICR_IRQ_SENT)) { \
psxHu32ref(0x1070) |= SWAP32(8); \
icr |= HW_DMA_ICR_IRQ_SENT; \
coverage_x = x1 >> 6;
- mask_up_left = 0xFFFF0000 << coverage_x;
- if(coverage_x < 0)
- mask_up_left = 0xFFFF0000;
+ mask_up_left = 0xFFFF0000;
+ if(coverage_x > 0)
+ mask_up_left <<= coverage_x;
coverage_y = y1 >> 8;
if(coverage_y <= 0)
vec_8x8s dither_offsets_short; \
\
dither_row = \
- (dither_row >> dither_shift) | (dither_row << (32 - dither_shift)); \
+ (dither_row >> dither_shift) | ((u64)dither_row << (32 - dither_shift)); \
dup_2x32b(vector_cast(vec_2x32u, dither_offsets_short), dither_row); \
setup_blocks_span_initialize_dithered_##texturing() \
#define dither_table_row(a, b, c, d) \
- ((a & 0xFF) | ((b & 0xFF) << 8) | ((c & 0xFF) << 16) | ((d & 0xFF) << 24)) \
+ ((a & 0xFF) | ((b & 0xFF) << 8) | ((c & 0xFF) << 16) | ((u32)(d & 0xFF) << 24)) \
void initialize_psx_gpu(psx_gpu_struct *psx_gpu, u16 *vram)
{