Back to index

glibc  2.9
Functions
wordcopy.c File Reference
#include <stddef.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 _wordcopy_fwd_aligned (long int dstp, long int srcp, size_t len)
void _wordcopy_fwd_dest_aligned (long int dstp, long int srcp, size_t len)
void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len)
void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len)

Function Documentation

void _wordcopy_bwd_aligned ( long int  dstp,
long int  srcp,
size_t  len 
)

Definition at line 123 of file wordcopy.c.

{
  op_t a0, a1;

  if (len & 1)
  {
    srcp -= OPSIZ;
    dstp -= OPSIZ;
    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
    
    if (len == 1)
      return;
    len -= 1;
  }

  do
    {
      srcp -= 2 * OPSIZ;
      dstp -= 2 * OPSIZ;

      a1 = ((op_t *) srcp)[1];
      a0 = ((op_t *) srcp)[0];
      ((op_t *) dstp)[1] = a1;
      ((op_t *) dstp)[0] = a0;

      len -= 2;
    }
  while (len != 0);
}
void _wordcopy_bwd_dest_aligned ( long int  dstp,
long int  srcp,
size_t  len 
)

Definition at line 162 of file wordcopy.c.

{
  op_t a0, a1, a2;
  int sh_1, sh_2;

  /* Calculate how to shift a word read at the memory operation
     aligned srcp to make it aligned for copy.  */

  sh_1 = 8 * (srcp % OPSIZ);
  sh_2 = 8 * OPSIZ - sh_1;

  /* Make srcp aligned by rounding it down to the beginning of the op_t
     it points in the middle of.  */
  srcp &= -OPSIZ;
  a2 = ((op_t *) srcp)[0];

  if (len & 1)
  {
    srcp -= OPSIZ;
    dstp -= OPSIZ;
    a1 = ((op_t *) srcp)[0];
    ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);

    if (len == 1)
      return;

    a2 = a1;
    len -= 1;
  }

  do
    {
      srcp -= 2 * OPSIZ;
      dstp -= 2 * OPSIZ;

      a1 = ((op_t *) srcp)[1];
      a0 = ((op_t *) srcp)[0];
      ((op_t *) dstp)[1] = MERGE (a1, sh_1, a2, sh_2);
      ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
      a2 = a0;

      len -= 2;
    }
  while (len != 0);
}
void _wordcopy_fwd_aligned ( long int  dstp,
long int  srcp,
size_t  len 
)

Definition at line 31 of file wordcopy.c.

{
  op_t a0, a1;

  if (len & 1)
  {
    ((op_t *) dstp)[0] = ((op_t *) srcp)[0];
    
    if (len == 1)
      return;
    srcp += OPSIZ;
    dstp += OPSIZ;
    len -= 1;
  }

  do
    {
      a0 = ((op_t *) srcp)[0];
      a1 = ((op_t *) srcp)[1];
      ((op_t *) dstp)[0] = a0;
      ((op_t *) dstp)[1] = a1;

      srcp += 2 * OPSIZ;
      dstp += 2 * OPSIZ;
      len -= 2;
    }
  while (len != 0);
}
void _wordcopy_fwd_dest_aligned ( long int  dstp,
long int  srcp,
size_t  len 
)

Definition at line 69 of file wordcopy.c.

{
  op_t a0, a1, a2;
  int sh_1, sh_2;

  /* Calculate how to shift a word read at the memory operation
     aligned srcp to make it aligned for copy.  */

  sh_1 = 8 * (srcp % OPSIZ);
  sh_2 = 8 * OPSIZ - sh_1;

  /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
     it points in the middle of.  */
  srcp &= -OPSIZ;
  a0 = ((op_t *) srcp)[0];

  if (len & 1)
  {
    a1 = ((op_t *) srcp)[1];
    ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
    
    if (len == 1)
      return;
    
    a0 = a1;
    srcp += OPSIZ;
    dstp += OPSIZ;
    len -= 1;
  }

  do
    {
      a1 = ((op_t *) srcp)[1];
      a2 = ((op_t *) srcp)[2];
      ((op_t *) dstp)[0] = MERGE (a0, sh_1, a1, sh_2);
      ((op_t *) dstp)[1] = MERGE (a1, sh_1, a2, sh_2);
      a0 = a2;

      srcp += 2 * OPSIZ;
      dstp += 2 * OPSIZ;
      len -= 2;
    }
  while (len != 0);
}