fmemops.c

来自「国外网站上的一些精典的C程序」· C语言 代码 · 共 63 行

C
63
字号
/***  FMEMOPS.C - Emulate MSC's far memory functions in ZTC++ & early BC++****  Original Copyright 1988-1992 by Bob Stout as part of**  the MicroFirm Function Library (MFL)****  The user is granted a free limited license to use this source file**  to create royalty-free programs, subject to the terms of the**  license restrictions specified in the LICENSE.MFL file.*/#if defined(__ZTC__) && !defined(__SC__)#include <stdlib.h>#include <dos.h>#include "fmemops.h"/***  Don't #include <string.h> to avoid incompatible prototypes*/#if __cplusplus extern "C" {#endifvoid CDECL movedata(unsigned,unsigned,unsigned,unsigned,size_t);#if __cplusplus }#endiftypedef unsigned char FAR *FarBytePtr;void FAR * _fmemcpy(void FAR *dest, void FAR *src, size_t count){      movedata(FP_SEG(src), FP_OFF(src), FP_SEG(dest), FP_OFF(dest), count);      return dest;}void FAR * _fmemmove(void FAR *dest, void FAR *src, size_t count){      void FAR *target =  dest;      FarBytePtr to = (FarBytePtr)dest, from = (FarBytePtr)src;      if (src >= dest)            _fmemcpy(dest, src, count);      else  for (to += count, from += count; count; --count)                  *--to = *--from;      return target;}void FAR * _fmemset(void FAR *dest, int ch, size_t count){      void FAR *target =  dest;      FarBytePtr to = (FarBytePtr)dest;      for ( ; count; --count)            *to++ = (unsigned char) ch;      return target;}#endif /* __ZTC__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?