* java/io/StringWriter.java (StringWriter(int)): Now public.
[official-gcc.git] / libiberty / bcopy.c
blobb655363d879e58f4b7f9377702964fdbd989af71
1 /* bcopy -- copy memory regions of arbitary length
3 NAME
4 bcopy -- copy memory regions of arbitrary length
6 SYNOPSIS
7 void bcopy (char *in, char *out, int length)
9 DESCRIPTION
10 Copy LENGTH bytes from memory region pointed to by IN to memory
11 region pointed to by OUT.
13 BUGS
14 Significant speed improvements can be made in some cases by
15 implementing copies of multiple bytes simultaneously, or unrolling
16 the copy loop.
20 void
21 bcopy (src, dest, len)
22 register char *src, *dest;
23 int len;
25 if (dest < src)
26 while (len--)
27 *dest++ = *src++;
28 else
30 char *lasts = src + (len-1);
31 char *lastd = dest + (len-1);
32 while (len--)
33 *(char *)lastd-- = *(char *)lasts--;