File: bcmp.c

package info (click to toggle)
mysql 3.23.49-8.13
  • links: PTS
  • area: main
  • in suites: woody
  • size: 65,624 kB
  • ctags: 45,242
  • sloc: ansic: 255,722; cpp: 86,801; perl: 26,117; tcl: 19,882; sh: 18,775; asm: 4,001; yacc: 2,626; makefile: 2,494; java: 2,300; awk: 1,484; sed: 428
file content (63 lines) | stat: -rw-r--r-- 1,709 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
   
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
   
   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
   MA 02111-1307, USA */

/*
  bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are
  identical to the "len" bytes starting at "s2", non-zero if they are
  different.
  Now only used with purify.
*/

#include <global.h>
#include "m_string.h"

#if !defined(bcmp) && !defined(HAVE_BCMP)

#if defined(MC68000) && defined(DS90)

int bcmp(s1,s2, len)
const char *s1;
const char *s2;
uint len;					/* 0 <= len <= 65535 */
{
  asm("		movl	12(a7),d0	");
  asm("		subqw	#1,d0		");
  asm("		blt	.L5		");
  asm("		movl	4(a7),a1	");
  asm("		movl	8(a7),a0	");
  asm(".L4:	cmpmb	(a0)+,(a1)+	");
  asm("		dbne	d0,.L4		");
  asm(".L5:	addqw	#1,d0		");
}

#else

#ifdef HAVE_purify
int my_bcmp(s1, s2, len)
#else
int bcmp(s1, s2, len)
#endif
    register const char *s1;
    register const char *s2;
    register uint len;
{
  while (len-- != 0 && *s1++ == *s2++) ;
  return len+1;
}

#endif
#endif /* BSD_FUNCS */