root/arch/m68k/lib/memcpy.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. memcpy

   1 #include <linux/types.h>
   2 
   3 void * memcpy(void * to, const void * from, size_t n)
     /* [previous][next][first][last][top][bottom][index][help] */
   4 {
   5   void *xto = to;
   6   size_t temp;
   7 
   8   if (!n)
   9     return xto;
  10   if ((long) to & 1)
  11     {
  12       char *cto = to;
  13       const char *cfrom = from;
  14       *cto++ = *cfrom++;
  15       to = cto;
  16       from = cfrom;
  17       n--;
  18     }
  19   if (n > 2 && (long) to & 2)
  20     {
  21       short *sto = to;
  22       const short *sfrom = from;
  23       *sto++ = *sfrom++;
  24       to = sto;
  25       from = sfrom;
  26       n -= 2;
  27     }
  28   temp = n >> 2;
  29   if (temp)
  30     {
  31       long *lto = to;
  32       const long *lfrom = from;
  33       temp--;
  34       do
  35         *lto++ = *lfrom++;
  36       while (temp--);
  37       to = lto;
  38       from = lfrom;
  39     }
  40   if (n & 2)
  41     {
  42       short *sto = to;
  43       const short *sfrom = from;
  44       *sto++ = *sfrom++;
  45       to = sto;
  46       from = sfrom;
  47     }
  48   if (n & 1)
  49     {
  50       char *cto = to;
  51       const char *cfrom = from;
  52       *cto = *cfrom;
  53     }
  54   return xto;
  55 }

/* [previous][next][first][last][top][bottom][index][help] */