Back to index

glibc  2.9
Functions
bzero.c File Reference
#include <string.h>
#include <memcopy.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void __bzero (void *s, size_t len)

Function Documentation

void __bzero ( void *  s,
size_t  len 
)

Definition at line 27 of file bzero.c.

{
  long int dstp = (long int) s;
  const op_t zero = 0;

  if (len >= 8)
    {
      size_t xlen;

      /* There are at least some bytes to zero.  No need to test
        for LEN == 0 in this alignment loop.  */
      while (dstp % OPSIZ != 0)
       {
         ((byte *) dstp)[0] = 0;
         dstp += 1;
         len -= 1;
       }

      /* Write 8 op_t per iteration until less than 8 op_t remain.  */
      xlen = len / (OPSIZ * 8);
      while (xlen != 0)
       {
         ((op_t *) dstp)[0] = zero;
         ((op_t *) dstp)[1] = zero;
         ((op_t *) dstp)[2] = zero;
         ((op_t *) dstp)[3] = zero;
         ((op_t *) dstp)[4] = zero;
         ((op_t *) dstp)[5] = zero;
         ((op_t *) dstp)[6] = zero;
         ((op_t *) dstp)[7] = zero;
         dstp += 8 * OPSIZ;
         xlen -= 1;
       }
      len %= OPSIZ * 8;

      /* Write 1 op_t per iteration until less than op_t remain.  */
      xlen = len / OPSIZ;
      while (xlen != 0)
       {
         ((op_t *) dstp)[0] = zero;
         dstp += OPSIZ;
         xlen -= 1;
       }
      len %= OPSIZ;
    }

  /* Write the last few bytes.  */
  while (len != 0)
    {
      ((byte *) dstp)[0] = 0;
      dstp += 1;
      len -= 1;
    }
}

Here is the caller graph for this function: