diff options
-rw-r--r-- | lib/libc/string/bcopy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libc/string/bcopy.c b/lib/libc/string/bcopy.c index 8f8a8cf..0c2ec94 100644 --- a/lib/libc/string/bcopy.c +++ b/lib/libc/string/bcopy.c @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/types.h> + /* * sizeof(word) MUST BE A POWER OF TWO * SO THAT wmask BELOW IS ALL ONES @@ -88,13 +90,13 @@ bcopy(const void *src0, void *dst0, size_t length) /* * Copy forward. */ - t = (int)src; /* only need low bits */ - if ((t | (int)dst) & wmask) { + t = (uintptr_t)src; /* only need low bits */ + if ((t | (uintptr_t)dst) & wmask) { /* * Try to align operands. This cannot be done * unless the low bits match. */ - if ((t ^ (int)dst) & wmask || length < wsize) + if ((t ^ (uintptr_t)dst) & wmask || length < wsize) t = length; else t = wsize - (t & wmask); @@ -116,9 +118,9 @@ bcopy(const void *src0, void *dst0, size_t length) */ src += length; dst += length; - t = (int)src; - if ((t | (int)dst) & wmask) { - if ((t ^ (int)dst) & wmask || length <= wsize) + t = (uintptr_t)src; + if ((t | (uintptr_t)dst) & wmask) { + if ((t ^ (uintptr_t)dst) & wmask || length <= wsize) t = length; else t &= wmask; |