PERFORCE change 28823 for review
Robert Drehmel
robert at FreeBSD.org
Sat Apr 12 08:50:37 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=28823
Change 28823 by robert at robert_spes on 2003/04/12 08:50:32
Use exact (and more) casts to be able to compile this with GCC 3.3 without
warnings, which in turn enables compilation of libstand with -Werror.
Affected files ...
.. //depot/projects/mips/lib/libc/string/bcopy.c#2 edit
Differences ...
==== //depot/projects/mips/lib/libc/string/bcopy.c#2 (text+ko) ====
@@ -40,6 +40,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/lib/libc/string/bcopy.c,v 1.5 2002/09/01 21:53:46 robert Exp $");
+#include <stdint.h>
+
/*
* sizeof(word) MUST BE A POWER OF TWO
* SO THAT wmask BELOW IS ALL ONES
@@ -88,13 +90,13 @@
/*
* Copy forward.
*/
- t = (int)src; /* only need low bits */
- if ((t | (int)dst) & wmask) {
+ t = (uint32_t)(uintptr_t)src; /* only need low bits */
+ if ((t | (uint32_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 ^ (uint32_t)(uintptr_t)dst) & wmask || length < wsize)
t = length;
else
t = wsize - (t & wmask);
@@ -116,9 +118,9 @@
*/
src += length;
dst += length;
- t = (int)src;
- if ((t | (int)dst) & wmask) {
- if ((t ^ (int)dst) & wmask || length <= wsize)
+ t = (uint32_t)(uintptr_t)src;
+ if ((t | (uint32_t)(uintptr_t)dst) & wmask) {
+ if ((t ^ (uint32_t)(uintptr_t)dst) & wmask || length <= wsize)
t = length;
else
t &= wmask;
More information about the p4-projects
mailing list