~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to strings/bfill.c

  • Committer: Brian Aker
  • Date: 2008-07-01 20:52:03 UTC
  • mfrom: (28.1.23 libtool-patch)
  • Revision ID: brian@tangent.org-20080701205203-3jm6ga57uzxy8k4t
Merge of taylor's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
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   : bfill.c
19
 
    Author : Richard A. O'Keefe.
20
 
             Michael Widenius;  ifdef MC68000
21
 
    Updated: 23 April 1984
22
 
    Defines: bfill()
23
 
 
24
 
    bfill(dst, len, fill) moves "len" fill characters to "dst".
25
 
    Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' ').
26
 
 
27
 
    Note: the "b" routines are there to exploit certain VAX order codes,
28
 
    but the MOVC5 instruction will only move 65535 characters.   The asm
29
 
    code is presented for your interest and amusement.
30
 
*/
31
 
 
32
 
#include <my_global.h>
33
 
#include "m_string.h"
34
 
 
35
 
#if !defined(bfill) && !defined(HAVE_BFILL)
36
 
 
37
 
#if VaxAsm
38
 
 
39
 
void bfill(dst, len, fill)
40
 
char *dst;
41
 
uint len;
42
 
int fill; /* actually char */
43
 
{
44
 
  asm("movc5 $0,*4(ap),12(ap),8(ap),*4(ap)");
45
 
}
46
 
 
47
 
#elif defined(MC68000) && defined(DS90)
48
 
 
49
 
void bfill(dst, len,fill)                       /* Optimized with long-fill */
50
 
char *dst;
51
 
uint len;
52
 
pchar fill;
53
 
{
54
 
asm("           movl    8.(a7),d1       ");
55
 
asm("           jeq     .L9             ");
56
 
asm("           movl    4.(a7),a0       ");
57
 
asm("           moveq   #0,d0           ");
58
 
asm("           movb    15.(a7),d0      ");
59
 
asm("           movl    d2,a1           ");
60
 
asm("           movw    d0,d2           ");
61
 
asm("           aslw    #8,d0           ");
62
 
asm("           orw     d2,d0           ");
63
 
asm("           movl    d0,d2           ");
64
 
asm("           swap    d0              ");
65
 
asm("           orl     d2,d0           ");
66
 
asm("           movl    a0,d2           ");
67
 
asm("           btst    #0,d2           ");
68
 
asm("           jeq     .L1             ");
69
 
asm("           movb    d0,(a0)+        ");
70
 
asm("           subql   #1,d1           ");
71
 
asm(".L1:       movl    d1,d2           ");
72
 
asm("           lsrl    #2,d2           ");
73
 
asm("           jcc     .L2             ");
74
 
asm("           movw    d0,(a0)+        ");
75
 
asm("           jra     .L2             ");
76
 
asm(".L3:       movl    d0,(a0)+        ");
77
 
asm(".L2:       dbra    d2,.L3          ");
78
 
asm("           addqw   #1,d2           ");
79
 
asm("           subql   #1,d2           ");
80
 
asm("           jcc     .L3             ");
81
 
asm("           andl    #1,d1           ");
82
 
asm("           jeq     .L8             ");
83
 
asm("           movb    d0,(a0)         ");
84
 
asm(".L8:       movl    a1,d2           ");
85
 
asm(".L9:       rts                     ");
86
 
}
87
 
#else
88
 
 
89
 
void bfill(dst, len, fill)
90
 
register byte *dst;
91
 
register uint len;
92
 
register pchar fill;
93
 
{
94
 
  while (len-- != 0) *dst++ = fill;
95
 
}
96
 
 
97
 
#endif
98
 
#endif