pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / elle / sbbcpy.c
blob463bd88eeb604145dea330319c8a701937d21e77
2 #include "sb.h"
4 /* BCOPY(from,to,cnt) - Copy string of bytes.
5 * Normally this routine is an assembly-language library routine,
6 * but not all systems have it. Hence this C-language version
7 * which tries to be fairly machine-independent.
8 * Attempts to be clever about using word moves instead of byte moves.
9 * Does not hack overlapping backward moves.
11 bcopy(from, to, cnt) /* Copy count bytes from -> to */
12 register SBMA from;
13 register SBMA to;
14 register unsigned cnt;
16 if(!cnt)
17 return;
18 while(rndrem((int)from)) /* Get source aligned */
19 { *to++ = *from++;
20 if(--cnt == 0) return;
22 if(rndrem((int)to) == 0) /* Do word move if dest now aligned */
23 { register unsigned tmp;
24 tmp = cnt;
25 if((cnt = rnddiv(cnt)) > 4)
26 { sbm_wcpy((int *)from, (int *)to, cnt);
27 if((cnt = rndrem(tmp)) == 0)
28 return; /* No leftover bytes, all done */
29 tmp -= cnt; /* Ugh, must update pointers */
30 from += tmp;
31 to += tmp;
33 else cnt = tmp; /* Not worth call overhead */
35 do { *to++ = *from++; } /* Finish up with byte loop */
36 while(--cnt);
39 /* SBM_WCPY - word-move auxiliary routine.
40 * This is a separate routine so that machines with only a few
41 * registers have a chance to use them for the word copy loop.
42 * This cannot be made part of BCOPY without doing some
43 * unnecessary pointer conversions and using extra variables
44 * (since most compilers will not accept type casts on lvalues,
45 * which are needed to treat (char *) as (int *)).
47 sbm_wcpy(from, to, cnt)
48 register int *from, *to;
49 register unsigned cnt;
51 if(cnt)
52 do { *to++ = *from++; }
53 while(--cnt);