Include <inttypes.h> when using intptr_t.
[tinc] / lib / memcmp.c
index 1226947..9104994 100644 (file)
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-   USA.  */
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation, Inc.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
 #undef __ptr_t
 #if defined __cplusplus || (defined __STDC__ && __STDC__)
 # define __ptr_t       void *
 #undef __ptr_t
 #if defined __cplusplus || (defined __STDC__ && __STDC__)
 # define __ptr_t       void *
@@ -107,8 +111,8 @@ static int
 memcmp_bytes (a, b)
      op_t a, b;
 {
 memcmp_bytes (a, b)
      op_t a, b;
 {
-  long int srcp1 = (long int) &a;
-  long int srcp2 = (long int) &b;
+  intptr_t srcp1 = (intptr_t) &a;
+  intptr_t srcp2 = (intptr_t) &b;
   op_t a0, b0;
 
   do
   op_t a0, b0;
 
   do
@@ -123,7 +127,7 @@ memcmp_bytes (a, b)
 }
 #endif
 
 }
 #endif
 
-static int memcmp_common_alignment __P((long, long, size_t));
+static int memcmp_common_alignment __P((intptr_t, intptr_t, size_t));
 
 /* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
    objects (not LEN bytes!).  Both SRCP1 and SRCP2 should be aligned for
 
 /* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
    objects (not LEN bytes!).  Both SRCP1 and SRCP2 should be aligned for
@@ -133,8 +137,8 @@ __inline
 #endif
 static int
 memcmp_common_alignment (srcp1, srcp2, len)
 #endif
 static int
 memcmp_common_alignment (srcp1, srcp2, len)
-     long int srcp1;
-     long int srcp2;
+     intptr_t srcp1;
+     intptr_t srcp2;
      size_t len;
 {
   op_t a0, a1;
      size_t len;
 {
   op_t a0, a1;
@@ -213,7 +217,7 @@ memcmp_common_alignment (srcp1, srcp2, len)
   return 0;
 }
 
   return 0;
 }
 
-static int memcmp_not_common_alignment __P((long, long, size_t));
+static int memcmp_not_common_alignment __P((intptr_t, intptr_t, size_t));
 
 /* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
    `op_t' objects (not LEN bytes!).  SRCP2 should be aligned for memory
 
 /* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
    `op_t' objects (not LEN bytes!).  SRCP2 should be aligned for memory
@@ -223,8 +227,8 @@ __inline
 #endif
 static int
 memcmp_not_common_alignment (srcp1, srcp2, len)
 #endif
 static int
 memcmp_not_common_alignment (srcp1, srcp2, len)
-     long int srcp1;
-     long int srcp2;
+     intptr_t srcp1;
+     intptr_t srcp2;
      size_t len;
 {
   op_t a0, a1, a2, a3;
      size_t len;
 {
   op_t a0, a1, a2, a3;
@@ -332,8 +336,8 @@ rpl_memcmp (s1, s2, len)
 {
   op_t a0;
   op_t b0;
 {
   op_t a0;
   op_t b0;
-  long int srcp1 = (long int) s1;
-  long int srcp2 = (long int) s2;
+  intptr_t srcp1 = (intptr_t) s1;
+  intptr_t srcp2 = (intptr_t) s2;
   op_t res;
 
   if (len >= OP_T_THRES)
   op_t res;
 
   if (len >= OP_T_THRES)