You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.7 KiB

26 years ago
26 years ago
24 years ago
26 years ago
26 years ago
24 years ago
24 years ago
24 years ago
26 years ago
24 years ago
24 years ago
24 years ago
26 years ago
  1. /* Copyright (C) 2000 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. /*
  13. bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are
  14. identical to the "len" bytes starting at "s2", non-zero if they are
  15. different.
  16. Now only used with purify because purify gives wrong warnings when
  17. comparing a shorter string with bcmp.
  18. */
  19. #include <my_global.h>
  20. #include "m_string.h"
  21. #ifdef HAVE_purify
  22. #undef bcmp
  23. #undef HAVE_BCMP
  24. #endif
  25. #if !defined(bcmp) && !defined(HAVE_BCMP)
  26. #if defined(MC68000) && defined(DS90)
  27. int bcmp(s1,s2, len)
  28. const char *s1;
  29. const char *s2;
  30. uint len; /* 0 <= len <= 65535 */
  31. {
  32. asm(" movl 12(a7),d0 ");
  33. asm(" subqw #1,d0 ");
  34. asm(" blt .L5 ");
  35. asm(" movl 4(a7),a1 ");
  36. asm(" movl 8(a7),a0 ");
  37. asm(".L4: cmpmb (a0)+,(a1)+ ");
  38. asm(" dbne d0,.L4 ");
  39. asm(".L5: addqw #1,d0 ");
  40. }
  41. #else
  42. #ifndef HAVE_purify
  43. int bcmp(register const char *s1,register const char *s2, register uint len)
  44. #else
  45. int my_bcmp(register const char *s1,register const char *s2, register uint len)
  46. #endif
  47. {
  48. while (len-- != 0 && *s1++ == *s2++) ;
  49. return len+1;
  50. }
  51. #endif
  52. #endif /* BSD_FUNCS */