Hi!

25-Мар-2004 00:20 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

> 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.

     Yes, it was.

>          case 0x01:
> +          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;

     Unlike this code, my code wasn't reject 0xC0 (HIGH_MASK), but this code
also may be simplified:

______________O\_/_________________________________\_/O______________
          if (lr.BL >= HIGH_MASK ||                 /* 0xc0 */
              (lr.BL & FIT_MASK) > LAST_FIT)        /* 0x3f, 0x02 */

_____________________________________________________________________
              O/~\                                 /~\O

where in mcb.h was defined:

______________O\_/_________________________________\_/O______________
#define HMASEG          0xFFFF

typedef enum {
  LARGEST               =   -1,
  FIRST_FIT             =    0,
  BEST_FIT              =    1,
  LAST_FIT              =    2,

  ALLOC_HIGH            = 0x40,
  ALLOC_HIGH_LOW        = 0x80,
  HIGH_MASK             = ALLOC_HIGH | ALLOC_HIGH_LOW,
  FIT_MASK              = ~HIGH_MASK,

  LOW_FIRST_FIT         =    0, /* low memory first fit         */
  LOW_BEST_FIT          =    1, /* low memory best fit          */
  LOW_LAST_FIT          =    2, /* low memory last fit          */
  HIGH_FIRST_FIT        = 0x40, /* high memory first fit        */
  HIGH_BEST_FIT         = 0x41, /* high memory best fit         */
  HIGH_LAST_FIT         = 0x42, /* high memory last fit         */
  HIGH_LOW_FIRST_FIT    = 0x80, /* high, then low mem first fit */
  HIGH_LOW_BEST_FIT     = 0x81, /* high, then low mem best fit  */
  HIGH_LOW_LAST_FIT     = 0x82  /* high, then low mem last fit  */
} ALLOC_STRATEGY;
_____________________________________________________________________
              O/~\                                 /~\O




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to