bcopy.c (8fb3f3f68288ae2b1b53dd65e3dd673d83c80f4c) | bcopy.c (bc0ad8e7a1c5acaebd9516356b2c00619f77a053) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 26 unchanged lines hidden (view full) --- 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> 41__FBSDID("$FreeBSD$"); 42 | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 26 unchanged lines hidden (view full) --- 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> 41__FBSDID("$FreeBSD$"); 42 |
43#include <string.h> 44 | |
45/* 46 * sizeof(word) MUST BE A POWER OF TWO 47 * SO THAT wmask BELOW IS ALL ONES 48 */ 49typedef int word; /* "word" used for optimal copy speed */ 50 51#define wsize sizeof(word) 52#define wmask (wsize - 1) 53 54/* 55 * Copy a block of memory, handling overlap. 56 * This is the routine that actually implements 57 * (the portable versions of) bcopy, memcpy, and memmove. 58 */ | 43/* 44 * sizeof(word) MUST BE A POWER OF TWO 45 * SO THAT wmask BELOW IS ALL ONES 46 */ 47typedef int word; /* "word" used for optimal copy speed */ 48 49#define wsize sizeof(word) 50#define wmask (wsize - 1) 51 52/* 53 * Copy a block of memory, handling overlap. 54 * This is the routine that actually implements 55 * (the portable versions of) bcopy, memcpy, and memmove. 56 */ |
59#ifdef MEMCOPY | 57#if defined(MEMCOPY) || defined(MEMMOVE) 58#include <string.h> 59 |
60void * | 60void * |
61memcpy(dst0, src0, length) | 61#ifdef MEMCOPY 62memcpy |
62#else | 63#else |
63#ifdef MEMMOVE 64void * 65memmove(dst0, src0, length) | 64memmove 65#endif 66(void *dst0, const void *src0, size_t length) |
66#else | 67#else |
68#include <strings.h> 69 |
|
67void | 70void |
68bcopy(src0, dst0, length) | 71bcopy(const void *src0, void *dst0, size_t length) |
69#endif | 72#endif |
70#endif 71 void *dst0; 72 const void *src0; 73 size_t length; | |
74{ 75 char *dst = dst0; 76 const char *src = src0; 77 size_t t; 78 79 if (length == 0 || dst == src) /* nothing to do */ 80 goto done; 81 --- 59 unchanged lines hidden --- | 73{ 74 char *dst = dst0; 75 const char *src = src0; 76 size_t t; 77 78 if (length == 0 || dst == src) /* nothing to do */ 79 goto done; 80 --- 59 unchanged lines hidden --- |