From d17f33324366370b8b6d9d33e65c7cfa232049af Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Thu, 25 Mar 2004 00:20:20 +0000 Subject: [PATCH] From Lucho (and I think Arkady had this as well at some point): save 33 bytes by eliminating a switch for memory/UMB access modes. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@822 6ac86273-5f31-0410-b378-82cca8765d1b --- hdr/mcb.h | 2 ++ kernel/inthndlr.c | 23 ++++------------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/hdr/mcb.h b/hdr/mcb.h index 0531b4c..6ff077c 100644 --- a/hdr/mcb.h +++ b/hdr/mcb.h @@ -45,6 +45,8 @@ static BYTE *mcb_hRcsId = #define FIRST_FIT_U 0x80 #define BEST_FIT_U 0x81 #define LAST_FIT_U 0x82 +#define FIT_U_MASK 0xc0 +#define FIT_MASK 0x3f #define MCB_NORMAL 0x4d #define MCB_LAST 0x5a diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index f4233ed..0a7f815 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1210,25 +1210,10 @@ dispatch: break; case 0x01: - { - switch (lr.BL) - { - case LAST_FIT: - case LAST_FIT_U: - case LAST_FIT_UO: - case BEST_FIT: - case BEST_FIT_U: - case BEST_FIT_UO: - case FIRST_FIT: - case FIRST_FIT_U: - case FIRST_FIT_UO: - mem_access_mode = lr.BL; - break; - - default: - goto error_invalid; - } - } + if ((lr.BL & FIT_U_MASK) > FIRST_FIT_U || /* 0xc0, 0x80 */ + (lr.BL & FIT_MASK) > LAST_FIT) /* 0x3f, 0x02 */ + goto error_invalid; + mem_access_mode = lr.BL; break; case 0x02: