Салям!

21-Мар-2004 13:56 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

> +void FAR * add_far(void FAR * fp, unsigned off)
>  {
> +  unsigned segment, offset;
>    if (FP_SEG(fp) == 0xffff)
> +    return ((char FAR *) fp) + off;
>  #ifndef I86
>    if (FP_SEG(fp) == 0)
> +    return ((char FAR *) fp) + off;
>  #endif
> +  offset = off + FP_OFF(fp);
> +  segment = FP_SEG(fp) + (offset >> 4);
> +  if (offset < off) /* forward carry without using a long */
> +    segment += 0x1000;
> +  return MK_FP(segment, offset & 0xf);
>  }

void FAR * add_far(void FAR * fp, unsigned off)
{
  if (FP_SEG(fp) == 0xffff ||
#ifndef I86
      FP_SEG(fp) == 0 ||
#endif
      off <= ~FP_OFF (fp)) /* off <= max - FP_OFF(fp) ? */
    return (char FAR*)fp + off;
  off += FP_OFF(fp);
  return MK_FP (FP_SEG (fp) + (off >> 4) + 0x1000, off & 0xf);
}

     Difference is that my code is simpler and normalizes pointers much less
frequently.




-------------------------------------------------------
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-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to