mirror of
https://github.com/n64dev/cen64.git
synced 2024-05-11 08:55:44 -04:00
Convert some asserts into regular code.
No need to assert for unlikely cases that can happen.
This commit is contained in:
parent
9f488ea96a
commit
cf38848d5b
|
@ -360,8 +360,6 @@ int write_pif_ram(void *opaque, uint32_t address, uint32_t word, uint32_t dqm) {
|
|||
int write_pif_rom_and_ram(void *opaque, uint32_t address, uint32_t word, uint32_t dqm) {
|
||||
if (address >= PIF_RAM_BASE_ADDRESS)
|
||||
return write_pif_ram(opaque, address, word, dqm);
|
||||
|
||||
assert(0 && "Attempt to write to PIF ROM.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,6 @@ const struct segment* get_segment(uint64_t address, uint32_t cp0_status) {
|
|||
unsigned segment_mode = segment_mode_lut[cp0_status & 0xFF];
|
||||
unsigned mode_and_flags_mask = cp0_status & 0x1E;
|
||||
|
||||
#ifndef NDEBUG
|
||||
uint64_t sexaddress = (int64_t) ((int32_t) address);
|
||||
|
||||
char kernel = (cp0_status & 0x6) || ((cp0_status & 0x18) == 0);
|
||||
|
@ -249,12 +248,14 @@ const struct segment* get_segment(uint64_t address, uint32_t cp0_status) {
|
|||
char use_ux = user && (cp0_status & 0x20);
|
||||
char use_64 = use_kx | use_sx | use_ux;
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Ensure that only one of {kernel, supervisor, user} are produced.
|
||||
assert(((kernel + supervisor + user) == 1) && "Impossible situation.");
|
||||
#endif
|
||||
|
||||
// Ensure that either 64-bit mode is used, or the address is sign-extended.
|
||||
assert((use_64 || (sexaddress == address)) && "Invalid 32-bit address.");
|
||||
#endif
|
||||
if(!use_64 && (sexaddress != address))
|
||||
return NULL;
|
||||
|
||||
// Check for useg/suseg/kuseg or xuseg/xsuseg/xkuseg first.
|
||||
seg = (const struct segment *) ((uintptr_t) USEGs + segment_mode);
|
||||
|
|
Loading…
Reference in a new issue