root/arch/alpha/lib/memset.c

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

DEFINITIONS

This source file includes following definitions.
  1. __constant_c_memset
  2. __memset

   1 /*
   2  *  linux/arch/alpha/lib/memset.c
   3  *
   4  *  Copyright (C) 1995  Linus Torvalds
   5  */
   6 
   7 /*
   8  * These are only slightly optimized so far..
   9  */
  10 
  11 #include <linux/types.h>
  12 
  13 inline void * __constant_c_memset(void * s, unsigned long c, long count)
     /* [previous][next][first][last][top][bottom][index][help] */
  14 {
  15         unsigned long xs = (unsigned long) s;
  16 
  17         /*
  18          * the first and last parts could be done with just one
  19          * unaligned load/store, but I don't want to think about it
  20          */
  21         while (count > 0 && (xs & 7)) {
  22                 *(char *) xs = c;
  23                 count--; xs++;
  24         }
  25         while (count > 7) {
  26                 *(unsigned long *) xs = c;
  27                 count -=8; xs += 8;
  28         }
  29         while (count > 0) {
  30                 *(char *) xs = c;
  31                 count--; xs++;
  32         }
  33         return s;
  34 }
  35 
  36 void * __memset(void * s,char c,size_t count)
     /* [previous][next][first][last][top][bottom][index][help] */
  37 {
  38         __constant_c_memset(s,0x0101010101010101UL * (unsigned char) c, count);
  39         return s;
  40 }

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