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.

80 lines
2.2 KiB

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