~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2002 MySQL AB
2
   
3
   This library is free software; you can redistribute it and/or
4
   modify it under the terms of the GNU Library General Public
5
   License as published by the Free Software Foundation; version 2
6
   of the License.
7
   
8
   This library is distributed in the hope that it will be useful,
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
   Library General Public License for more details.
12
   
13
   You should have received a copy of the GNU Library General Public
14
   License along with this library; if not, write to the Free
15
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16
   MA 02111-1307, USA */
17
18
/*  File   : bmove.c
19
    Author : Richard A. O'Keefe.
20
	     Michael Widenius;	ifdef MC68000
21
    Updated: 23 April 1984
22
    Defines: bmove()
23
24
    bmove(dst, src, len) moves exactly "len" bytes from the source "src"
25
    to the destination "dst".  It does not check for NUL characters as
26
    strncpy() and strnmov() do.  Thus if your C compiler doesn't support
27
    structure assignment, you can simulate it with
28
    bmove(&to, &from, sizeof from);
29
    The standard 4.2bsd routine for this purpose is bcopy.  But as bcopy
30
    has its first two arguments the other way around you may find this a
31
    bit easier to get right.
32
    No value is returned.
33
34
    Note: the "b" routines are there to exploit certain VAX order codes,
35
    but the MOVC3 instruction will only move 65535 characters.	 The asm
36
    code is presented for your interest and amusement.
37
*/
38
39
#include <my_global.h>
40
#include "m_string.h"
41
42
#if !defined(HAVE_BMOVE) && !defined(bmove)
43
44
#if VaxAsm
45
46
void bmove(dst, src, len)
47
    char *dst, *src;
48
    uint len;
49
    {
50
 asm("movc3 12(ap),*8(ap),*4(ap)");
51
    }
52
53
#else
54
#if defined(MC68000) && defined(DS90)
55
56
void bmove(dst, src, len)
57
char *dst,*src;
58
uint len;				/* 0 <= len <= 65535 */
59
{
60
asm("		movl	12(a7),d0	");
61
asm("		subql	#1,d0		");
62
asm("		blt	.L5		");
63
asm("		movl	4(a7),a1	");
64
asm("		movl	8(a7),a0	");
65
asm(".L4:	movb	(a0)+,(a1)+	");
66
asm("		dbf	d0,.L4		");
67
asm(".L5:				");
68
}
69
#else
70
71
void bmove(dst, src, len)
72
register char *dst;
73
register const char *src;
74
register uint len;
75
{
76
  while (len-- != 0) *dst++ = *src++;
77
}
78
#endif
79
#endif
80
#endif