Use constants for clarity.

This commit is contained in:
Florian Nücke
2020-09-25 14:49:27 +02:00
parent 2f747558e9
commit 1528c6ea53
2 changed files with 4 additions and 4 deletions

View File

@@ -398,11 +398,11 @@ public final class UART16550A implements Resettable, Steppable, MemoryMappedDevi
}
}
fcr = (byte) (value & 0b11001001);
fcr = (byte) (value & (UART_FCR_FE | UART_FCR_DMS | UART_FCR_ITL_MASK));
if ((value & UART_FCR_FE) != 0) {
if ((fcr & UART_FCR_FE) != 0) {
iir |= UART_IIR_FIFO_ENABLED;
switch (value & UART_FCR_ITL_MASK) {
switch (fcr & UART_FCR_ITL_MASK) {
case UART_FCR_ITL1: {
triggerLevel = 1;
break;

View File

@@ -2675,7 +2675,7 @@ public class R5CPU implements Steppable, RealTimeCounter, InterruptController {
final int vpnShift = R5.PAGE_ADDRESS_SHIFT + R5.SV32_XPN_SIZE * i;
final int vpn = (virtualAddress >>> vpnShift) & R5.SV32_XPN_MASK;
pteAddress += vpn << R5.SV32_PTE_SIZE_LOG2; // equivalent to vpn * PTE size
int pte = physicalMemory.load(pteAddress, 2); // 3.
int pte = (int) physicalMemory.load(pteAddress, Sizes.SIZE_32_LOG2); // 3.
if ((pte & R5.PTE_V_MASK) == 0 || ((pte & R5.PTE_R_MASK) == 0 && (pte & R5.PTE_W_MASK) != 0)) { // 4.
throw getPageFaultException(accessType, virtualAddress);