e4cc04a
From 6156d208e6cc6e28a964be5dd34585bd54f6eadf Mon Sep 17 00:00:00 2001
91c6a95
From: Xavier Leroy <xavier.leroy@inria.fr>
91c6a95
Date: Wed, 27 Aug 2014 09:58:33 +0000
5d60b03
Subject: [PATCH 11/12] PR#6517: use ISO C99 types {,u}int{32,64}_t in
91c6a95
 preference to our homegrown types {,u}int{32,64}.
91c6a95
91c6a95
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15131 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
91c6a95
91c6a95
----------------------------------------------------------------------
91c6a95
For Fedora:
91c6a95
91c6a95
This commit was cherry picked from upstream
91c6a95
commit b868c05ec91a7ee193010a421de768a3b1a80952 (SVN 15131).
91c6a95
91c6a95
See also:
91c6a95
91c6a95
http://caml.inria.fr/mantis/view.php?id=6517
91c6a95
---
91c6a95
 asmrun/backtrace.c                  |   6 +-
91c6a95
 byterun/alloc.h                     |   4 +-
91c6a95
 byterun/backtrace.c                 |   2 +-
91c6a95
 byterun/config.h                    |  35 +++++++----
91c6a95
 byterun/debugger.h                  |  28 ++++-----
91c6a95
 byterun/exec.h                      |   4 +-
91c6a95
 byterun/extern.c                    |   4 +-
91c6a95
 byterun/fix_code.c                  |   8 +--
91c6a95
 byterun/floats.c                    |   6 +-
91c6a95
 byterun/globroots.c                 |   4 +-
91c6a95
 byterun/hash.c                      |  44 +++++++-------
91c6a95
 byterun/hash.h                      |  12 ++--
91c6a95
 byterun/int64_emul.h                | 114 ++++++++++++++++++------------------
91c6a95
 byterun/int64_format.h              |   4 +-
91c6a95
 byterun/int64_native.h              |  20 +++----
91c6a95
 byterun/intern.c                    |  20 +++----
91c6a95
 byterun/interp.c                    |   2 +-
91c6a95
 byterun/intext.h                    |  12 ++--
91c6a95
 byterun/ints.c                      | 112 +++++++++++++++++------------------
91c6a95
 byterun/io.c                        |   6 +-
91c6a95
 byterun/io.h                        |   6 +-
91c6a95
 byterun/md5.c                       |  26 ++++----
91c6a95
 byterun/md5.h                       |   6 +-
91c6a95
 byterun/mlvalues.h                  |  12 ++--
91c6a95
 byterun/startup.c                   |  10 ++--
91c6a95
 byterun/startup.h                   |   4 +-
91c6a95
 byterun/str.c                       |  20 +++----
91c6a95
 config/auto-aux/int64align.c        |  14 ++---
91c6a95
 config/s-nt.h                       |   3 +
91c6a95
 configure                           |  25 ++------
91c6a95
 otherlibs/bigarray/bigarray_stubs.c |  48 +++++++--------
91c6a95
 otherlibs/num/nat_stubs.c           |  14 ++---
91c6a95
 otherlibs/unix/addrofstr.c          |   2 +-
91c6a95
 stdlib/header.c                     |   2 +-
91c6a95
 34 files changed, 319 insertions(+), 320 deletions(-)
91c6a95
91c6a95
diff --git a/asmrun/backtrace.c b/asmrun/backtrace.c
91c6a95
index c72a237..773e22c 100644
91c6a95
--- a/asmrun/backtrace.c
91c6a95
+++ b/asmrun/backtrace.c
91c6a95
@@ -217,7 +217,7 @@ static void extract_location_info(frame_descr * d,
91c6a95
                                   /*out*/ struct loc_info * li)
91c6a95
 {
91c6a95
   uintnat infoptr;
91c6a95
-  uint32 info1, info2;
91c6a95
+  uint32_t info1, info2;
91c6a95
 
91c6a95
   /* If no debugging information available, print nothing.
91c6a95
      When everything is compiled with -g, this corresponds to
91c6a95
@@ -232,8 +232,8 @@ static void extract_location_info(frame_descr * d,
91c6a95
              sizeof(char *) + sizeof(short) + sizeof(short) +
91c6a95
              sizeof(short) * d->num_live + sizeof(frame_descr *) - 1)
91c6a95
             & -sizeof(frame_descr *);
91c6a95
-  info1 = ((uint32 *)infoptr)[0];
91c6a95
-  info2 = ((uint32 *)infoptr)[1];
91c6a95
+  info1 = ((uint32_t *)infoptr)[0];
91c6a95
+  info2 = ((uint32_t *)infoptr)[1];
91c6a95
   /* Format of the two info words:
91c6a95
        llllllllllllllllllll aaaaaaaa bbbbbbbbbb nnnnnnnnnnnnnnnnnnnnnnnn kk
91c6a95
                           44       36         26                       2  0
91c6a95
diff --git a/byterun/alloc.h b/byterun/alloc.h
91c6a95
index f00a7ef..2a640eb 100644
91c6a95
--- a/byterun/alloc.h
91c6a95
+++ b/byterun/alloc.h
91c6a95
@@ -32,8 +32,8 @@ CAMLextern value caml_alloc_string (mlsize_t);  /* size in bytes */
91c6a95
 CAMLextern value caml_copy_string (char const *);
91c6a95
 CAMLextern value caml_copy_string_array (char const **);
91c6a95
 CAMLextern value caml_copy_double (double);
91c6a95
-CAMLextern value caml_copy_int32 (int32);       /* defined in [ints.c] */
91c6a95
-CAMLextern value caml_copy_int64 (int64);       /* defined in [ints.c] */
91c6a95
+CAMLextern value caml_copy_int32 (int32_t);       /* defined in [ints.c] */
91c6a95
+CAMLextern value caml_copy_int64 (int64_t);       /* defined in [ints.c] */
91c6a95
 CAMLextern value caml_copy_nativeint (intnat);  /* defined in [ints.c] */
91c6a95
 CAMLextern value caml_alloc_array (value (*funct) (char const *),
91c6a95
                                    char const ** array);
91c6a95
diff --git a/byterun/backtrace.c b/byterun/backtrace.c
91c6a95
index 76e3ddf..6ed56c8 100644
91c6a95
--- a/byterun/backtrace.c
91c6a95
+++ b/byterun/backtrace.c
91c6a95
@@ -229,7 +229,7 @@ static void read_debug_info(void)
91c6a95
   int fd;
91c6a95
   struct exec_trailer trail;
91c6a95
   struct channel * chan;
91c6a95
-  uint32 num_events, orig, i;
91c6a95
+  uint32_t num_events, orig, i;
91c6a95
   intnat j;
91c6a95
   value evl, l, ev_start;
91c6a95
 
91c6a95
diff --git a/byterun/config.h b/byterun/config.h
91c6a95
index f775988..6c86d16 100644
91c6a95
--- a/byterun/config.h
91c6a95
+++ b/byterun/config.h
91c6a95
@@ -25,24 +25,30 @@
91c6a95
 #include "compatibility.h"
91c6a95
 #endif
91c6a95
 
91c6a95
-/* Types for 32-bit integers, 64-bit integers,
91c6a95
+#ifdef HAS_STDINT_H
91c6a95
+#include <stdint.h>
91c6a95
+#endif
91c6a95
+
91c6a95
+/* Types for 32-bit integers, 64-bit integers, and
91c6a95
    native integers (as wide as a pointer type) */
91c6a95
 
91c6a95
+#ifndef ARCH_INT32_TYPE
91c6a95
 #if SIZEOF_INT == 4
91c6a95
-typedef int int32;
91c6a95
-typedef unsigned int uint32;
91c6a95
+#define ARCH_INT32_TYPE int
91c6a95
+#define ARCH_UINT32_TYPE unsigned int
91c6a95
 #define ARCH_INT32_PRINTF_FORMAT ""
91c6a95
 #elif SIZEOF_LONG == 4
91c6a95
-typedef long int32;
91c6a95
-typedef unsigned long uint32;
91c6a95
+#define ARCH_INT32_TYPE long
91c6a95
+#define ARCH_UINT32_TYPE unsigned long
91c6a95
 #define ARCH_INT32_PRINTF_FORMAT "l"
91c6a95
 #elif SIZEOF_SHORT == 4
91c6a95
-typedef short int32;
91c6a95
-typedef unsigned short uint32;
91c6a95
+#define ARCH_INT32_TYPE short
91c6a95
+#define ARCH_UINT32_TYPE unsigned short
91c6a95
 #define ARCH_INT32_PRINTF_FORMAT ""
91c6a95
 #else
91c6a95
 #error "No 32-bit integer type available"
91c6a95
 #endif
91c6a95
+#endif
91c6a95
 
91c6a95
 #ifndef ARCH_INT64_TYPE
91c6a95
 #if SIZEOF_LONGLONG == 8
91c6a95
@@ -58,8 +64,13 @@ typedef unsigned short uint32;
91c6a95
 #endif
91c6a95
 #endif
91c6a95
 
91c6a95
-typedef ARCH_INT64_TYPE int64;
91c6a95
-typedef ARCH_UINT64_TYPE uint64;
91c6a95
+#ifndef HAS_STDINT_H
91c6a95
+/* Not a C99 compiler, typically MSVC.  Define the C99 types we use. */
91c6a95
+typedef ARCH_INT32_TYPE int32_t;
91c6a95
+typedef ARCH_UINT32_TYPE uint32_t;
91c6a95
+typedef ARCH_INT64_TYPE int64_t;
91c6a95
+typedef ARCH_UINT64_TYPE uint64_t;
91c6a95
+#endif
91c6a95
 
91c6a95
 #if SIZEOF_PTR == SIZEOF_LONG
91c6a95
 /* Standard models: ILP32 or I32LP64 */
91c6a95
@@ -72,9 +83,9 @@ typedef int intnat;
91c6a95
 typedef unsigned int uintnat;
91c6a95
 #define ARCH_INTNAT_PRINTF_FORMAT ""
91c6a95
 #elif SIZEOF_PTR == 8
91c6a95
-/* Win64 model: IL32LLP64 */
91c6a95
-typedef int64 intnat;
91c6a95
-typedef uint64 uintnat;
91c6a95
+/* Win64 model: IL32P64 */
91c6a95
+typedef int64_t intnat;
91c6a95
+typedef uint64_t uintnat;
91c6a95
 #define ARCH_INTNAT_PRINTF_FORMAT ARCH_INT64_PRINTF_FORMAT
91c6a95
 #else
91c6a95
 #error "No integer type available to represent pointers"
91c6a95
diff --git a/byterun/debugger.h b/byterun/debugger.h
91c6a95
index b5079eb..e68ef75 100644
91c6a95
--- a/byterun/debugger.h
91c6a95
+++ b/byterun/debugger.h
91c6a95
@@ -37,17 +37,17 @@ void caml_debugger_cleanup_fork (void);
91c6a95
 /* Requests from the debugger to the runtime system */
91c6a95
 
91c6a95
 enum debugger_request {
91c6a95
-  REQ_SET_EVENT = 'e',          /* uint32 pos */
91c6a95
+  REQ_SET_EVENT = 'e',          /* uint32_t pos */
91c6a95
   /* Set an event on the instruction at position pos */
91c6a95
-  REQ_SET_BREAKPOINT = 'B',     /* uint32 pos, (char k) */
91c6a95
+  REQ_SET_BREAKPOINT = 'B',     /* uint32_t pos, (char k) */
91c6a95
   /* Set a breakpoint at position pos */
91c6a95
   /* In profiling mode, the breakpoint kind is set to k */
91c6a95
-  REQ_RESET_INSTR = 'i',        /* uint32 pos */
91c6a95
+  REQ_RESET_INSTR = 'i',        /* uint32_t pos */
91c6a95
   /* Clear an event or breapoint at position pos, restores initial instr. */
91c6a95
   REQ_CHECKPOINT = 'c',         /* no args */
91c6a95
   /* Checkpoint the runtime system by forking a child process.
91c6a95
      Reply is pid of child process or -1 if checkpoint failed. */
91c6a95
-  REQ_GO = 'g',                 /* uint32 n */
91c6a95
+  REQ_GO = 'g',                 /* uint32_t n */
91c6a95
   /* Run the program for n events.
91c6a95
      Reply is one of debugger_reply described below. */
91c6a95
   REQ_STOP = 's',               /* no args */
91c6a95
@@ -59,38 +59,38 @@ enum debugger_request {
91c6a95
      Reply is stack offset and current pc. */
91c6a95
   REQ_GET_FRAME = 'f',          /* no args */
91c6a95
   /* Return current frame location (stack offset + current pc). */
91c6a95
-  REQ_SET_FRAME = 'S',          /* uint32 stack_offset */
91c6a95
+  REQ_SET_FRAME = 'S',          /* uint32_t stack_offset */
91c6a95
   /* Set current frame to given stack offset. No reply. */
91c6a95
-  REQ_UP_FRAME = 'U',           /* uint32 n */
91c6a95
+  REQ_UP_FRAME = 'U',           /* uint32_t n */
91c6a95
   /* Move one frame up. Argument n is size of current frame (in words).
91c6a95
      Reply is stack offset and current pc, or -1 if top of stack reached. */
91c6a95
-  REQ_SET_TRAP_BARRIER = 'b',   /* uint32 offset */
91c6a95
+  REQ_SET_TRAP_BARRIER = 'b',   /* uint32_t offset */
91c6a95
   /* Set the trap barrier at the given offset. */
91c6a95
-  REQ_GET_LOCAL = 'L',          /* uint32 slot_number */
91c6a95
+  REQ_GET_LOCAL = 'L',          /* uint32_t slot_number */
91c6a95
   /* Return the local variable at the given slot in the current frame.
91c6a95
      Reply is one value. */
91c6a95
-  REQ_GET_ENVIRONMENT = 'E',    /* uint32 slot_number */
91c6a95
+  REQ_GET_ENVIRONMENT = 'E',    /* uint32_t slot_number */
91c6a95
   /* Return the local variable at the given slot in the heap environment
91c6a95
      of the current frame. Reply is one value. */
91c6a95
-  REQ_GET_GLOBAL = 'G',         /* uint32 global_number */
91c6a95
+  REQ_GET_GLOBAL = 'G',         /* uint32_t global_number */
91c6a95
   /* Return the specified global variable. Reply is one value. */
91c6a95
   REQ_GET_ACCU = 'A',           /* no args */
91c6a95
   /* Return the current contents of the accumulator. Reply is one value. */
91c6a95
   REQ_GET_HEADER = 'H',         /* mlvalue v */
91c6a95
   /* As REQ_GET_OBJ, but sends only the header. */
91c6a95
-  REQ_GET_FIELD = 'F',          /* mlvalue v, uint32 fieldnum */
91c6a95
+  REQ_GET_FIELD = 'F',          /* mlvalue v, uint32_t fieldnum */
91c6a95
   /* As REQ_GET_OBJ, but sends only one field. */
91c6a95
   REQ_MARSHAL_OBJ = 'M',        /* mlvalue v */
91c6a95
   /* Send a copy of the data structure rooted at v, using the same
91c6a95
      format as [caml_output_value]. */
91c6a95
   REQ_GET_CLOSURE_CODE = 'C',   /* mlvalue v */
91c6a95
   /* Send the code address of the given closure.
91c6a95
-     Reply is one uint32. */
91c6a95
-  REQ_SET_FORK_MODE = 'K'       /* uint32 m */
91c6a95
+     Reply is one uint32_t. */
91c6a95
+  REQ_SET_FORK_MODE = 'K'       /* uint32_t m */
91c6a95
   /* Set whether to follow the child (m=0) or the parent on fork. */
91c6a95
 };
91c6a95
 
91c6a95
-/* Replies to a REQ_GO request. All replies are followed by three uint32:
91c6a95
+/* Replies to a REQ_GO request. All replies are followed by three uint32_t:
91c6a95
    - the value of the event counter
91c6a95
    - the position of the stack
91c6a95
    - the current pc. */
91c6a95
diff --git a/byterun/exec.h b/byterun/exec.h
91c6a95
index a58bcf8..7e084ac 100644
91c6a95
--- a/byterun/exec.h
91c6a95
+++ b/byterun/exec.h
91c6a95
@@ -39,13 +39,13 @@
91c6a95
 
91c6a95
 struct section_descriptor {
91c6a95
   char name[4];                 /* Section name */
91c6a95
-  uint32 len;                   /* Length of data in bytes */
91c6a95
+  uint32_t len;                   /* Length of data in bytes */
91c6a95
 };
91c6a95
 
91c6a95
 /* Structure of the trailer. */
91c6a95
 
91c6a95
 struct exec_trailer {
91c6a95
-  uint32 num_sections;          /* Number of sections */
91c6a95
+  uint32_t num_sections;          /* Number of sections */
91c6a95
   char magic[12];               /* The magic number */
91c6a95
   struct section_descriptor * section; /* Not part of file */
91c6a95
 };
91c6a95
diff --git a/byterun/extern.c b/byterun/extern.c
91c6a95
index 33fa89a..e67d7a3 100644
91c6a95
--- a/byterun/extern.c
91c6a95
+++ b/byterun/extern.c
91c6a95
@@ -720,7 +720,7 @@ CAMLexport void caml_serialize_int_2(int i)
91c6a95
   extern_ptr += 2;
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport void caml_serialize_int_4(int32 i)
91c6a95
+CAMLexport void caml_serialize_int_4(int32_t i)
91c6a95
 {
91c6a95
   if (extern_ptr + 4 > extern_limit) grow_extern_output(4);
91c6a95
   extern_ptr[0] = i >> 24;
91c6a95
@@ -730,7 +730,7 @@ CAMLexport void caml_serialize_int_4(int32 i)
91c6a95
   extern_ptr += 4;
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport void caml_serialize_int_8(int64 i)
91c6a95
+CAMLexport void caml_serialize_int_8(int64_t i)
91c6a95
 {
91c6a95
   caml_serialize_block_8(&i, 1);
91c6a95
 }
91c6a95
diff --git a/byterun/fix_code.c b/byterun/fix_code.c
91c6a95
index 3380dc9..4fa0275 100644
91c6a95
--- a/byterun/fix_code.c
91c6a95
+++ b/byterun/fix_code.c
91c6a95
@@ -134,12 +134,12 @@ void caml_thread_code (code_t code, asize_t len)
91c6a95
     }
91c6a95
     *p++ = (opcode_t)(caml_instr_table[instr] - caml_instr_base);
91c6a95
     if (instr == SWITCH) {
91c6a95
-      uint32 sizes = *p++;
91c6a95
-      uint32 const_size = sizes & 0xFFFF;
91c6a95
-      uint32 block_size = sizes >> 16;
91c6a95
+      uint32_t sizes = *p++;
91c6a95
+      uint32_t const_size = sizes & 0xFFFF;
91c6a95
+      uint32_t block_size = sizes >> 16;
91c6a95
       p += const_size + block_size;
91c6a95
     } else if (instr == CLOSUREREC) {
91c6a95
-      uint32 nfuncs = *p++;
91c6a95
+      uint32_t nfuncs = *p++;
91c6a95
       p++;                      /* skip nvars */
91c6a95
       p += nfuncs;
91c6a95
     } else {
91c6a95
diff --git a/byterun/floats.c b/byterun/floats.c
91c6a95
index 7ff6d89..d8fdd05 100644
91c6a95
--- a/byterun/floats.c
91c6a95
+++ b/byterun/floats.c
91c6a95
@@ -378,9 +378,9 @@ CAMLprim value caml_log1p_float(value f)
91c6a95
 union double_as_two_int32 {
91c6a95
     double d;
91c6a95
 #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__))
91c6a95
-    struct { uint32 h; uint32 l; } i;
91c6a95
+    struct { uint32_t h; uint32_t l; } i;
91c6a95
 #else
91c6a95
-    struct { uint32 l; uint32 h; } i;
91c6a95
+    struct { uint32_t l; uint32_t h; } i;
91c6a95
 #endif
91c6a95
 };
91c6a95
 
91c6a95
@@ -467,7 +467,7 @@ CAMLprim value caml_classify_float(value vd)
91c6a95
   }
91c6a95
 #else
91c6a95
   union double_as_two_int32 u;
91c6a95
-  uint32 h, l;
91c6a95
+  uint32_t h, l;
91c6a95
 
91c6a95
   u.d = Double_val(vd);
91c6a95
   h = u.i.h;  l = u.i.l;
91c6a95
diff --git a/byterun/globroots.c b/byterun/globroots.c
91c6a95
index ded393e..d9111ee 100644
91c6a95
--- a/byterun/globroots.c
91c6a95
+++ b/byterun/globroots.c
91c6a95
@@ -43,11 +43,11 @@ struct global_root_list {
91c6a95
    (i.e. 2 * (NUM_LEVELS - 1)).  Moreover, the congruential PRNG
91c6a95
    is faster and guaranteed to be deterministic (to reproduce bugs). */
91c6a95
 
91c6a95
-static uint32 random_seed = 0;
91c6a95
+static uint32_t random_seed = 0;
91c6a95
 
91c6a95
 static int random_level(void)
91c6a95
 {
91c6a95
-  uint32 r;
91c6a95
+  uint32_t r;
91c6a95
   int level = 0;
91c6a95
 
91c6a95
   /* Linear congruence with modulus = 2^32, multiplier = 69069
91c6a95
diff --git a/byterun/hash.c b/byterun/hash.c
91c6a95
index f896426..12912d3 100644
91c6a95
--- a/byterun/hash.c
91c6a95
+++ b/byterun/hash.c
91c6a95
@@ -41,7 +41,7 @@
91c6a95
   h *= 0xc2b2ae35; \
91c6a95
   h ^= h >> 16;
91c6a95
 
91c6a95
-CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d)
91c6a95
+CAMLexport uint32_t caml_hash_mix_uint32(uint32_t h, uint32_t d)
91c6a95
 {
91c6a95
   MIX(h, d);
91c6a95
   return h;
91c6a95
@@ -49,17 +49,17 @@ CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d)
91c6a95
 
91c6a95
 /* Mix a platform-native integer. */
91c6a95
 
91c6a95
-CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d)
91c6a95
+CAMLexport uint32_t caml_hash_mix_intnat(uint32_t h, intnat d)
91c6a95
 {
91c6a95
-  uint32 n;
91c6a95
+  uint32_t n;
91c6a95
 #ifdef ARCH_SIXTYFOUR
91c6a95
   /* Mix the low 32 bits and the high 32 bits, in a way that preserves
91c6a95
-     32/64 compatibility: we want n = (uint32) d
91c6a95
+     32/64 compatibility: we want n = (uint32_t) d
91c6a95
      if d is in the range [-2^31, 2^31-1]. */
91c6a95
   n = (d >> 32) ^ (d >> 63) ^ d;
91c6a95
   /* If 0 <= d < 2^31:   d >> 32 = 0     d >> 63 = 0
91c6a95
      If -2^31 <= d < 0:  d >> 32 = -1    d >> 63 = -1
91c6a95
-     In both cases, n = (uint32) d.  */
91c6a95
+     In both cases, n = (uint32_t) d.  */
91c6a95
 #else
91c6a95
   n = d;
91c6a95
 #endif
91c6a95
@@ -69,9 +69,9 @@ CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d)
91c6a95
 
91c6a95
 /* Mix a 64-bit integer. */
91c6a95
 
91c6a95
-CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d)
91c6a95
+CAMLexport uint32_t caml_hash_mix_int64(uint32_t h, int64_t d)
91c6a95
 {
91c6a95
-  uint32 hi = (uint32) (d >> 32), lo = (uint32) d;
91c6a95
+  uint32_t hi = (uint32_t) (d >> 32), lo = (uint32_t) d;
91c6a95
   MIX(h, lo);
91c6a95
   MIX(h, hi);
91c6a95
   return h;
91c6a95
@@ -82,17 +82,17 @@ CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d)
91c6a95
    Treats all NaNs identically.
91c6a95
 */
91c6a95
 
91c6a95
-CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d)
91c6a95
+CAMLexport uint32_t caml_hash_mix_double(uint32_t hash, double d)
91c6a95
 {
91c6a95
   union {
91c6a95
     double d;
91c6a95
 #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__))
91c6a95
-    struct { uint32 h; uint32 l; } i;
91c6a95
+    struct { uint32_t h; uint32_t l; } i;
91c6a95
 #else
91c6a95
-    struct { uint32 l; uint32 h; } i;
91c6a95
+    struct { uint32_t l; uint32_t h; } i;
91c6a95
 #endif
91c6a95
   } u;
91c6a95
-  uint32 h, l;
91c6a95
+  uint32_t h, l;
91c6a95
   /* Convert to two 32-bit halves */
91c6a95
   u.d = d;
91c6a95
   h = u.i.h; l = u.i.l;
91c6a95
@@ -115,14 +115,14 @@ CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d)
91c6a95
    Treats all NaNs identically.
91c6a95
 */
91c6a95
 
91c6a95
-CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d)
91c6a95
+CAMLexport uint32_t caml_hash_mix_float(uint32_t hash, float d)
91c6a95
 {
91c6a95
   union {
91c6a95
     float f;
91c6a95
-    uint32 i;
91c6a95
+    uint32_t i;
91c6a95
   } u;
91c6a95
-  uint32 n;
91c6a95
-  /* Convert to int32 */
91c6a95
+  uint32_t n;
91c6a95
+  /* Convert to int32_t */
91c6a95
   u.f = d;  n = u.i;
91c6a95
   /* Normalize NaNs */
91c6a95
   if ((n & 0x7F800000) == 0x7F800000 && (n & 0x007FFFFF) != 0) {
91c6a95
@@ -138,11 +138,11 @@ CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d)
91c6a95
 
91c6a95
 /* Mix an OCaml string */
91c6a95
 
91c6a95
-CAMLexport uint32 caml_hash_mix_string(uint32 h, value s)
91c6a95
+CAMLexport uint32_t caml_hash_mix_string(uint32_t h, value s)
91c6a95
 {
91c6a95
   mlsize_t len = caml_string_length(s);
91c6a95
   mlsize_t i;
91c6a95
-  uint32 w;
91c6a95
+  uint32_t w;
91c6a95
 
91c6a95
   /* Mix by 32-bit blocks (little-endian) */
91c6a95
   for (i = 0; i + 4 <= len; i += 4) {
91c6a95
@@ -152,7 +152,7 @@ CAMLexport uint32 caml_hash_mix_string(uint32 h, value s)
91c6a95
         | (Byte_u(s, i+2) << 16)
91c6a95
         | (Byte_u(s, i+3) << 24);
91c6a95
 #else
91c6a95
-    w = *((uint32 *) &Byte_u(s, i));
91c6a95
+    w = *((uint32_t *) &Byte_u(s, i));
91c6a95
 #endif
91c6a95
     MIX(h, w);
91c6a95
   }
91c6a95
@@ -166,7 +166,7 @@ CAMLexport uint32 caml_hash_mix_string(uint32 h, value s)
91c6a95
   default: /*skip*/;     /* len & 3 == 0, no extra bytes, do nothing */
91c6a95
   }
91c6a95
   /* Finally, mix in the length.  Ignore the upper 32 bits, generally 0. */
91c6a95
-  h ^= (uint32) len;
91c6a95
+  h ^= (uint32_t) len;
91c6a95
   return h;
91c6a95
 }
91c6a95
 
91c6a95
@@ -184,7 +184,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj)
91c6a95
   intnat wr;                    /* One past position of last value in queue */
91c6a95
   intnat sz;                    /* Max number of values to put in queue */
91c6a95
   intnat num;                   /* Max number of meaningful values to see */
91c6a95
-  uint32 h;                     /* Rolling hash */
91c6a95
+  uint32_t h;                     /* Rolling hash */
91c6a95
   value v;
91c6a95
   mlsize_t i, len;
91c6a95
 
91c6a95
@@ -245,7 +245,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj)
91c6a95
         /* If no hashing function provided, do nothing. */
91c6a95
         /* Only use low 32 bits of custom hash, for 32/64 compatibility */
91c6a95
         if (Custom_ops_val(v)->hash != NULL) {
91c6a95
-          uint32 n = (uint32) Custom_ops_val(v)->hash(v);
91c6a95
+          uint32_t n = (uint32_t) Custom_ops_val(v)->hash(v);
91c6a95
           h = caml_hash_mix_uint32(h, n);
91c6a95
           num--;
91c6a95
         }
91c6a95
@@ -408,5 +408,5 @@ CAMLexport value caml_hash_variant(char const * tag)
91c6a95
 #endif
91c6a95
   /* Force sign extension of bit 31 for compatibility between 32 and 64-bit
91c6a95
      platforms */
91c6a95
-  return (int32) accu;
91c6a95
+  return (int32_t) accu;
91c6a95
 }
91c6a95
diff --git a/byterun/hash.h b/byterun/hash.h
91c6a95
index 436a8bb..6561397 100644
91c6a95
--- a/byterun/hash.h
91c6a95
+++ b/byterun/hash.h
91c6a95
@@ -18,12 +18,12 @@
91c6a95
 
91c6a95
 #include "mlvalues.h"
91c6a95
 
91c6a95
-CAMLextern uint32 caml_hash_mix_uint32(uint32 h, uint32 d);
91c6a95
-CAMLextern uint32 caml_hash_mix_intnat(uint32 h, intnat d);
91c6a95
-CAMLextern uint32 caml_hash_mix_int64(uint32 h, int64 d);
91c6a95
-CAMLextern uint32 caml_hash_mix_double(uint32 h, double d);
91c6a95
-CAMLextern uint32 caml_hash_mix_float(uint32 h, float d);
91c6a95
-CAMLextern uint32 caml_hash_mix_string(uint32 h, value s);
91c6a95
+CAMLextern uint32_t caml_hash_mix_uint32(uint32_t h, uint32_t d);
91c6a95
+CAMLextern uint32_t caml_hash_mix_intnat(uint32_t h, intnat d);
91c6a95
+CAMLextern uint32_t caml_hash_mix_int64(uint32_t h, int64_t d);
91c6a95
+CAMLextern uint32_t caml_hash_mix_double(uint32_t h, double d);
91c6a95
+CAMLextern uint32_t caml_hash_mix_float(uint32_t h, float d);
91c6a95
+CAMLextern uint32_t caml_hash_mix_string(uint32_t h, value s);
91c6a95
 
91c6a95
 
91c6a95
 #endif
91c6a95
diff --git a/byterun/int64_emul.h b/byterun/int64_emul.h
91c6a95
index ba7904a..2554df1 100644
91c6a95
--- a/byterun/int64_emul.h
91c6a95
+++ b/byterun/int64_emul.h
91c6a95
@@ -28,7 +28,7 @@
91c6a95
 #define I64_split(x,hi,lo) (hi = (x).h, lo = (x).l)
91c6a95
 
91c6a95
 /* Unsigned comparison */
91c6a95
-static int I64_ucompare(uint64 x, uint64 y)
91c6a95
+static int I64_ucompare(uint64_t x, uint64_t y)
91c6a95
 {
91c6a95
   if (x.h > y.h) return 1;
91c6a95
   if (x.h < y.h) return -1;
91c6a95
@@ -40,19 +40,19 @@ static int I64_ucompare(uint64 x, uint64 y)
91c6a95
 #define I64_ult(x, y) (I64_ucompare(x, y) < 0)
91c6a95
 
91c6a95
 /* Signed comparison */
91c6a95
-static int I64_compare(int64 x, int64 y)
91c6a95
+static int I64_compare(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  if ((int32)x.h > (int32)y.h) return 1;
91c6a95
-  if ((int32)x.h < (int32)y.h) return -1;
91c6a95
+  if ((int32_t)x.h > (int32_t)y.h) return 1;
91c6a95
+  if ((int32_t)x.h < (int32_t)y.h) return -1;
91c6a95
   if (x.l > y.l) return 1;
91c6a95
   if (x.l < y.l) return -1;
91c6a95
   return 0;
91c6a95
 }
91c6a95
 
91c6a95
 /* Negation */
91c6a95
-static int64 I64_neg(int64 x)
91c6a95
+static int64_t I64_neg(int64_t x)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = -x.l;
91c6a95
   res.h = ~x.h;
91c6a95
   if (res.l == 0) res.h++;
91c6a95
@@ -60,9 +60,9 @@ static int64 I64_neg(int64 x)
91c6a95
 }
91c6a95
 
91c6a95
 /* Addition */
91c6a95
-static int64 I64_add(int64 x, int64 y)
91c6a95
+static int64_t I64_add(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = x.l + y.l;
91c6a95
   res.h = x.h + y.h;
91c6a95
   if (res.l < x.l) res.h++;
91c6a95
@@ -70,9 +70,9 @@ static int64 I64_add(int64 x, int64 y)
91c6a95
 }
91c6a95
 
91c6a95
 /* Subtraction */
91c6a95
-static int64 I64_sub(int64 x, int64 y)
91c6a95
+static int64_t I64_sub(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = x.l - y.l;
91c6a95
   res.h = x.h - y.h;
91c6a95
   if (x.l < y.l) res.h--;
91c6a95
@@ -80,13 +80,13 @@ static int64 I64_sub(int64 x, int64 y)
91c6a95
 }
91c6a95
 
91c6a95
 /* Multiplication */
91c6a95
-static int64 I64_mul(int64 x, int64 y)
91c6a95
+static int64_t I64_mul(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
-  uint32 prod00 = (x.l & 0xFFFF) * (y.l & 0xFFFF);
91c6a95
-  uint32 prod10 = (x.l >> 16) * (y.l & 0xFFFF);
91c6a95
-  uint32 prod01 = (x.l & 0xFFFF) * (y.l >> 16);
91c6a95
-  uint32 prod11 = (x.l >> 16) * (y.l >> 16);
91c6a95
+  int64_t res;
91c6a95
+  uint32_t prod00 = (x.l & 0xFFFF) * (y.l & 0xFFFF);
91c6a95
+  uint32_t prod10 = (x.l >> 16) * (y.l & 0xFFFF);
91c6a95
+  uint32_t prod01 = (x.l & 0xFFFF) * (y.l >> 16);
91c6a95
+  uint32_t prod11 = (x.l >> 16) * (y.l >> 16);
91c6a95
   res.l = prod00;
91c6a95
   res.h = prod11 + (prod01 >> 16) + (prod10 >> 16);
91c6a95
   prod01 = prod01 << 16; res.l += prod01; if (res.l < prod01) res.h++;
91c6a95
@@ -96,39 +96,39 @@ static int64 I64_mul(int64 x, int64 y)
91c6a95
 }
91c6a95
 
91c6a95
 #define I64_is_zero(x) (((x).l | (x).h) == 0)
91c6a95
-#define I64_is_negative(x) ((int32) (x).h < 0)
91c6a95
+#define I64_is_negative(x) ((int32_t) (x).h < 0)
91c6a95
 #define I64_is_min_int(x) ((x).l == 0 && (x).h == 0x80000000U)
91c6a95
 #define I64_is_minus_one(x) (((x).l & (x).h) == 0xFFFFFFFFU)
91c6a95
 
91c6a95
 /* Bitwise operations */
91c6a95
-static int64 I64_and(int64 x, int64 y)
91c6a95
+static int64_t I64_and(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = x.l & y.l;
91c6a95
   res.h = x.h & y.h;
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_or(int64 x, int64 y)
91c6a95
+static int64_t I64_or(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = x.l | y.l;
91c6a95
   res.h = x.h | y.h;
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_xor(int64 x, int64 y)
91c6a95
+static int64_t I64_xor(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = x.l ^ y.l;
91c6a95
   res.h = x.h ^ y.h;
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
 /* Shifts */
91c6a95
-static int64 I64_lsl(int64 x, int s)
91c6a95
+static int64_t I64_lsl(int64_t x, int s)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   s = s & 63;
91c6a95
   if (s == 0) return x;
91c6a95
   if (s < 32) {
91c6a95
@@ -141,9 +141,9 @@ static int64 I64_lsl(int64 x, int s)
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_lsr(int64 x, int s)
91c6a95
+static int64_t I64_lsr(int64_t x, int s)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   s = s & 63;
91c6a95
   if (s == 0) return x;
91c6a95
   if (s < 32) {
91c6a95
@@ -156,17 +156,17 @@ static int64 I64_lsr(int64 x, int s)
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_asr(int64 x, int s)
91c6a95
+static int64_t I64_asr(int64_t x, int s)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   s = s & 63;
91c6a95
   if (s == 0) return x;
91c6a95
   if (s < 32) {
91c6a95
     res.l = (x.l >> s) | (x.h << (32 - s));
91c6a95
-    res.h = (int32) x.h >> s;
91c6a95
+    res.h = (int32_t) x.h >> s;
91c6a95
   } else {
91c6a95
-    res.l = (int32) x.h >> (s - 32);
91c6a95
-    res.h = (int32) x.h >> 31;
91c6a95
+    res.l = (int32_t) x.h >> (s - 32);
91c6a95
+    res.h = (int32_t) x.h >> 31;
91c6a95
   }
91c6a95
   return res;
91c6a95
 }
91c6a95
@@ -176,15 +176,15 @@ static int64 I64_asr(int64 x, int s)
91c6a95
 #define I64_SHL1(x) x.h = (x.h << 1) | (x.l >> 31); x.l <<= 1
91c6a95
 #define I64_SHR1(x) x.l = (x.l >> 1) | (x.h << 31); x.h >>= 1
91c6a95
 
91c6a95
-static void I64_udivmod(uint64 modulus, uint64 divisor,
91c6a95
-                        uint64 * quo, uint64 * mod)
91c6a95
+static void I64_udivmod(uint64_t modulus, uint64_t divisor,
91c6a95
+                        uint64_t * quo, uint64_t * mod)
91c6a95
 {
91c6a95
-  int64 quotient, mask;
91c6a95
+  int64_t quotient, mask;
91c6a95
   int cmp;
91c6a95
 
91c6a95
   quotient.h = 0; quotient.l = 0;
91c6a95
   mask.h = 0; mask.l = 1;
91c6a95
-  while ((int32) divisor.h >= 0) {
91c6a95
+  while ((int32_t) divisor.h >= 0) {
91c6a95
     cmp = I64_ucompare(divisor, modulus);
91c6a95
     I64_SHL1(divisor);
91c6a95
     I64_SHL1(mask);
91c6a95
@@ -202,27 +202,27 @@ static void I64_udivmod(uint64 modulus, uint64 divisor,
91c6a95
   *mod = modulus;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_div(int64 x, int64 y)
91c6a95
+static int64_t I64_div(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 q, r;
91c6a95
-  int32 sign;
91c6a95
+  int64_t q, r;
91c6a95
+  int32_t sign;
91c6a95
 
91c6a95
   sign = x.h ^ y.h;
91c6a95
-  if ((int32) x.h < 0) x = I64_neg(x);
91c6a95
-  if ((int32) y.h < 0) y = I64_neg(y);
91c6a95
+  if ((int32_t) x.h < 0) x = I64_neg(x);
91c6a95
+  if ((int32_t) y.h < 0) y = I64_neg(y);
91c6a95
   I64_udivmod(x, y, &q, &r);
91c6a95
   if (sign < 0) q = I64_neg(q);
91c6a95
   return q;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_mod(int64 x, int64 y)
91c6a95
+static int64_t I64_mod(int64_t x, int64_t y)
91c6a95
 {
91c6a95
-  int64 q, r;
91c6a95
-  int32 sign;
91c6a95
+  int64_t q, r;
91c6a95
+  int32_t sign;
91c6a95
 
91c6a95
   sign = x.h;
91c6a95
-  if ((int32) x.h < 0) x = I64_neg(x);
91c6a95
-  if ((int32) y.h < 0) y = I64_neg(y);
91c6a95
+  if ((int32_t) x.h < 0) x = I64_neg(x);
91c6a95
+  if ((int32_t) y.h < 0) y = I64_neg(y);
91c6a95
   I64_udivmod(x, y, &q, &r);
91c6a95
   if (sign < 0) r = I64_neg(r);
91c6a95
   return r;
91c6a95
@@ -230,49 +230,49 @@ static int64 I64_mod(int64 x, int64 y)
91c6a95
 
91c6a95
 /* Coercions */
91c6a95
 
91c6a95
-static int64 I64_of_int32(int32 x)
91c6a95
+static int64_t I64_of_int32(int32_t x)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.l = x;
91c6a95
   res.h = x >> 31;
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-#define I64_to_int32(x) ((int32) (x).l)
91c6a95
+#define I64_to_int32(x) ((int32_t) (x).l)
91c6a95
 
91c6a95
 /* Note: we assume sizeof(intnat) = 4 here, which is true otherwise
91c6a95
    autoconfiguration would have selected native 64-bit integers */
91c6a95
 #define I64_of_intnat I64_of_int32
91c6a95
 #define I64_to_intnat I64_to_int32
91c6a95
 
91c6a95
-static double I64_to_double(int64 x)
91c6a95
+static double I64_to_double(int64_t x)
91c6a95
 {
91c6a95
   double res;
91c6a95
-  int32 sign = x.h;
91c6a95
+  int32_t sign = x.h;
91c6a95
   if (sign < 0) x = I64_neg(x);
91c6a95
   res = ldexp((double) x.h, 32) + x.l;
91c6a95
   if (sign < 0) res = -res;
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_of_double(double f)
91c6a95
+static int64_t I64_of_double(double f)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   double frac, integ;
91c6a95
   int neg;
91c6a95
 
91c6a95
   neg = (f < 0);
91c6a95
   f = fabs(f);
91c6a95
   frac = modf(ldexp(f, -32), &integ);
91c6a95
-  res.h = (uint32) integ;
91c6a95
-  res.l = (uint32) ldexp(frac, 32);
91c6a95
+  res.h = (uint32_t) integ;
91c6a95
+  res.l = (uint32_t) ldexp(frac, 32);
91c6a95
   if (neg) res = I64_neg(res);
91c6a95
   return res;
91c6a95
 }
91c6a95
 
91c6a95
-static int64 I64_bswap(int64 x)
91c6a95
+static int64_t I64_bswap(int64_t x)
91c6a95
 {
91c6a95
-  int64 res;
91c6a95
+  int64_t res;
91c6a95
   res.h = (((x.l & 0x000000FF) << 24) |
91c6a95
            ((x.l & 0x0000FF00) << 8) |
91c6a95
            ((x.l & 0x00FF0000) >> 8) |
91c6a95
diff --git a/byterun/int64_format.h b/byterun/int64_format.h
91c6a95
index b0de527..aa8f1ab 100644
91c6a95
--- a/byterun/int64_format.h
91c6a95
+++ b/byterun/int64_format.h
91c6a95
@@ -17,7 +17,7 @@
91c6a95
 #ifndef CAML_INT64_FORMAT_H
91c6a95
 #define CAML_INT64_FORMAT_H
91c6a95
 
91c6a95
-static void I64_format(char * buffer, char * fmt, int64 x)
91c6a95
+static void I64_format(char * buffer, char * fmt, int64_t x)
91c6a95
 {
91c6a95
   static char conv_lower[] = "0123456789abcdef";
91c6a95
   static char conv_upper[] = "0123456789ABCDEF";
91c6a95
@@ -26,7 +26,7 @@ static void I64_format(char * buffer, char * fmt, int64 x)
91c6a95
   int base, width, sign, i, rawlen;
91c6a95
   char * cvtbl;
91c6a95
   char * p, * r;
91c6a95
-  int64 wbase, digit;
91c6a95
+  int64_t wbase, digit;
91c6a95
 
91c6a95
   /* Parsing of format */
91c6a95
   justify = '+';
91c6a95
diff --git a/byterun/int64_native.h b/byterun/int64_native.h
91c6a95
index e9ffe67..b6716ad 100644
91c6a95
--- a/byterun/int64_native.h
91c6a95
+++ b/byterun/int64_native.h
91c6a95
@@ -18,36 +18,36 @@
91c6a95
 #ifndef CAML_INT64_NATIVE_H
91c6a95
 #define CAML_INT64_NATIVE_H
91c6a95
 
91c6a95
-#define I64_literal(hi,lo) ((int64)(hi) << 32 | (lo))
91c6a95
-#define I64_split(x,hi,lo) (hi = (uint32)((x)>>32), lo = (uint32)(x))
91c6a95
+#define I64_literal(hi,lo) ((int64_t)(hi) << 32 | (lo))
91c6a95
+#define I64_split(x,hi,lo) (hi = (uint32_t)((x)>>32), lo = (uint32_t)(x))
91c6a95
 #define I64_compare(x,y) (((x) > (y)) - ((x) < (y)))
91c6a95
-#define I64_ult(x,y) ((uint64)(x) < (uint64)(y))
91c6a95
+#define I64_ult(x,y) ((uint64_t)(x) < (uint64_t)(y))
91c6a95
 #define I64_neg(x) (-(x))
91c6a95
 #define I64_add(x,y) ((x) + (y))
91c6a95
 #define I64_sub(x,y) ((x) - (y))
91c6a95
 #define I64_mul(x,y) ((x) * (y))
91c6a95
 #define I64_is_zero(x) ((x) == 0)
91c6a95
 #define I64_is_negative(x) ((x) < 0)
91c6a95
-#define I64_is_min_int(x) ((x) == ((int64)1 << 63))
91c6a95
+#define I64_is_min_int(x) ((x) == ((int64_t)1 << 63))
91c6a95
 #define I64_is_minus_one(x) ((x) == -1)
91c6a95
 
91c6a95
 #define I64_div(x,y) ((x) / (y))
91c6a95
 #define I64_mod(x,y) ((x) % (y))
91c6a95
 #define I64_udivmod(x,y,quo,rem) \
91c6a95
-  (*(rem) = (uint64)(x) % (uint64)(y), \
91c6a95
-   *(quo) = (uint64)(x) / (uint64)(y))
91c6a95
+  (*(rem) = (uint64_t)(x) % (uint64_t)(y), \
91c6a95
+   *(quo) = (uint64_t)(x) / (uint64_t)(y))
91c6a95
 #define I64_and(x,y) ((x) & (y))
91c6a95
 #define I64_or(x,y) ((x) | (y))
91c6a95
 #define I64_xor(x,y) ((x) ^ (y))
91c6a95
 #define I64_lsl(x,y) ((x) << (y))
91c6a95
 #define I64_asr(x,y) ((x) >> (y))
91c6a95
-#define I64_lsr(x,y) ((uint64)(x) >> (y))
91c6a95
+#define I64_lsr(x,y) ((uint64_t)(x) >> (y))
91c6a95
 #define I64_to_intnat(x) ((intnat) (x))
91c6a95
 #define I64_of_intnat(x) ((intnat) (x))
91c6a95
-#define I64_to_int32(x) ((int32) (x))
91c6a95
-#define I64_of_int32(x) ((int64) (x))
91c6a95
+#define I64_to_int32(x) ((int32_t) (x))
91c6a95
+#define I64_of_int32(x) ((int64_t) (x))
91c6a95
 #define I64_to_double(x) ((double)(x))
91c6a95
-#define I64_of_double(x) ((int64)(x))
91c6a95
+#define I64_of_double(x) ((int64_t)(x))
91c6a95
 
91c6a95
 #define I64_bswap(x) ((((x) & 0x00000000000000FFULL) << 56) | \
91c6a95
                       (((x) & 0x000000000000FF00ULL) << 40) | \
91c6a95
diff --git a/byterun/intern.c b/byterun/intern.c
91c6a95
index e0fcc5d..638ff72 100644
91c6a95
--- a/byterun/intern.c
91c6a95
+++ b/byterun/intern.c
91c6a95
@@ -553,7 +553,7 @@ static void intern_add_to_heap(mlsize_t whsize)
91c6a95
 
91c6a95
 value caml_input_val(struct channel *chan)
91c6a95
 {
91c6a95
-  uint32 magic;
91c6a95
+  uint32_t magic;
91c6a95
   mlsize_t block_len, num_objects, whsize;
91c6a95
   char * block;
91c6a95
   value res;
91c6a95
@@ -663,7 +663,7 @@ static value input_val_from_block(void)
91c6a95
 
91c6a95
 CAMLexport value caml_input_value_from_malloc(char * data, intnat ofs)
91c6a95
 {
91c6a95
-  uint32 magic;
91c6a95
+  uint32_t magic;
91c6a95
   value obj;
91c6a95
 
91c6a95
   intern_input = (unsigned char *) data;
91c6a95
@@ -681,7 +681,7 @@ CAMLexport value caml_input_value_from_malloc(char * data, intnat ofs)
91c6a95
 
91c6a95
 CAMLexport value caml_input_value_from_block(char * data, intnat len)
91c6a95
 {
91c6a95
-  uint32 magic;
91c6a95
+  uint32_t magic;
91c6a95
   mlsize_t block_len;
91c6a95
   value obj;
91c6a95
 
91c6a95
@@ -700,7 +700,7 @@ CAMLexport value caml_input_value_from_block(char * data, intnat len)
91c6a95
 
91c6a95
 CAMLprim value caml_marshal_data_size(value buff, value ofs)
91c6a95
 {
91c6a95
-  uint32 magic;
91c6a95
+  uint32_t magic;
91c6a95
   mlsize_t block_len;
91c6a95
 
91c6a95
   intern_src = &Byte_u(buff, Long_val(ofs));
91c6a95
@@ -771,26 +771,26 @@ CAMLexport int caml_deserialize_sint_2(void)
91c6a95
   return read16s();
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport uint32 caml_deserialize_uint_4(void)
91c6a95
+CAMLexport uint32_t caml_deserialize_uint_4(void)
91c6a95
 {
91c6a95
   return read32u();
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport int32 caml_deserialize_sint_4(void)
91c6a95
+CAMLexport int32_t caml_deserialize_sint_4(void)
91c6a95
 {
91c6a95
   return read32s();
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport uint64 caml_deserialize_uint_8(void)
91c6a95
+CAMLexport uint64_t caml_deserialize_uint_8(void)
91c6a95
 {
91c6a95
-  uint64 i;
91c6a95
+  uint64_t i;
91c6a95
   caml_deserialize_block_8(&i, 1);
91c6a95
   return i;
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport int64 caml_deserialize_sint_8(void)
91c6a95
+CAMLexport int64_t caml_deserialize_sint_8(void)
91c6a95
 {
91c6a95
-  int64 i;
91c6a95
+  int64_t i;
91c6a95
   caml_deserialize_block_8(&i, 1);
91c6a95
   return i;
91c6a95
 }
91c6a95
diff --git a/byterun/interp.c b/byterun/interp.c
91c6a95
index 9b682ba..e22b28b 100644
91c6a95
--- a/byterun/interp.c
91c6a95
+++ b/byterun/interp.c
91c6a95
@@ -793,7 +793,7 @@ value caml_interprete(code_t prog, asize_t prog_size)
91c6a95
       if (accu == Val_false) pc += *pc; else pc++;
91c6a95
       Next;
91c6a95
     Instruct(SWITCH): {
91c6a95
-      uint32 sizes = *pc++;
91c6a95
+      uint32_t sizes = *pc++;
91c6a95
       if (Is_block(accu)) {
91c6a95
         intnat index = Tag_val(accu);
91c6a95
         Assert ((uintnat) index < (sizes >> 16));
91c6a95
diff --git a/byterun/intext.h b/byterun/intext.h
91c6a95
index f7aa655..2c108a4 100644
91c6a95
--- a/byterun/intext.h
91c6a95
+++ b/byterun/intext.h
91c6a95
@@ -119,8 +119,8 @@ CAMLextern value caml_input_value_from_block(char * data, intnat len);
91c6a95
 
91c6a95
 CAMLextern void caml_serialize_int_1(int i);
91c6a95
 CAMLextern void caml_serialize_int_2(int i);
91c6a95
-CAMLextern void caml_serialize_int_4(int32 i);
91c6a95
-CAMLextern void caml_serialize_int_8(int64 i);
91c6a95
+CAMLextern void caml_serialize_int_4(int32_t i);
91c6a95
+CAMLextern void caml_serialize_int_8(int64_t i);
91c6a95
 CAMLextern void caml_serialize_float_4(float f);
91c6a95
 CAMLextern void caml_serialize_float_8(double f);
91c6a95
 CAMLextern void caml_serialize_block_1(void * data, intnat len);
91c6a95
@@ -133,10 +133,10 @@ CAMLextern int caml_deserialize_uint_1(void);
91c6a95
 CAMLextern int caml_deserialize_sint_1(void);
91c6a95
 CAMLextern int caml_deserialize_uint_2(void);
91c6a95
 CAMLextern int caml_deserialize_sint_2(void);
91c6a95
-CAMLextern uint32 caml_deserialize_uint_4(void);
91c6a95
-CAMLextern int32 caml_deserialize_sint_4(void);
91c6a95
-CAMLextern uint64 caml_deserialize_uint_8(void);
91c6a95
-CAMLextern int64 caml_deserialize_sint_8(void);
91c6a95
+CAMLextern uint32_t caml_deserialize_uint_4(void);
91c6a95
+CAMLextern int32_t caml_deserialize_sint_4(void);
91c6a95
+CAMLextern uint64_t caml_deserialize_uint_8(void);
91c6a95
+CAMLextern int64_t caml_deserialize_sint_8(void);
91c6a95
 CAMLextern float caml_deserialize_float_4(void);
91c6a95
 CAMLextern double caml_deserialize_float_8(void);
91c6a95
 CAMLextern void caml_deserialize_block_1(void * data, intnat len);
91c6a95
diff --git a/byterun/ints.c b/byterun/ints.c
91c6a95
index d762c76..056e82a 100644
91c6a95
--- a/byterun/ints.c
91c6a95
+++ b/byterun/ints.c
91c6a95
@@ -172,8 +172,8 @@ CAMLprim value caml_format_int(value fmt, value arg)
91c6a95
 
91c6a95
 static int int32_cmp(value v1, value v2)
91c6a95
 {
91c6a95
-  int32 i1 = Int32_val(v1);
91c6a95
-  int32 i2 = Int32_val(v2);
91c6a95
+  int32_t i1 = Int32_val(v1);
91c6a95
+  int32_t i2 = Int32_val(v2);
91c6a95
   return (i1 > i2) - (i1 < i2);
91c6a95
 }
91c6a95
 
91c6a95
@@ -191,7 +191,7 @@ static void int32_serialize(value v, uintnat * wsize_32,
91c6a95
 
91c6a95
 static uintnat int32_deserialize(void * dst)
91c6a95
 {
91c6a95
-  *((int32 *) dst) = caml_deserialize_sint_4();
91c6a95
+  *((int32_t *) dst) = caml_deserialize_sint_4();
91c6a95
   return 4;
91c6a95
 }
91c6a95
 
91c6a95
@@ -205,7 +205,7 @@ CAMLexport struct custom_operations caml_int32_ops = {
91c6a95
   custom_compare_ext_default
91c6a95
 };
91c6a95
 
91c6a95
-CAMLexport value caml_copy_int32(int32 i)
91c6a95
+CAMLexport value caml_copy_int32(int32_t i)
91c6a95
 {
91c6a95
   value res = caml_alloc_custom(&caml_int32_ops, 4, 0, 1);
91c6a95
   Int32_val(res) = i;
91c6a95
@@ -226,8 +226,8 @@ CAMLprim value caml_int32_mul(value v1, value v2)
91c6a95
 
91c6a95
 CAMLprim value caml_int32_div(value v1, value v2)
91c6a95
 {
91c6a95
-  int32 dividend = Int32_val(v1);
91c6a95
-  int32 divisor = Int32_val(v2);
91c6a95
+  int32_t dividend = Int32_val(v1);
91c6a95
+  int32_t divisor = Int32_val(v2);
91c6a95
   if (divisor == 0) caml_raise_zero_divide();
91c6a95
   /* PR#4740: on some processors, division crashes on overflow.
91c6a95
      Implement the same behavior as for type "int". */
91c6a95
@@ -237,8 +237,8 @@ CAMLprim value caml_int32_div(value v1, value v2)
91c6a95
 
91c6a95
 CAMLprim value caml_int32_mod(value v1, value v2)
91c6a95
 {
91c6a95
-  int32 dividend = Int32_val(v1);
91c6a95
-  int32 divisor = Int32_val(v2);
91c6a95
+  int32_t dividend = Int32_val(v1);
91c6a95
+  int32_t divisor = Int32_val(v2);
91c6a95
   if (divisor == 0) caml_raise_zero_divide();
91c6a95
   /* PR#4740: on some processors, modulus crashes if division overflows.
91c6a95
      Implement the same behavior as for type "int". */
91c6a95
@@ -262,9 +262,9 @@ CAMLprim value caml_int32_shift_right(value v1, value v2)
91c6a95
 { return caml_copy_int32(Int32_val(v1) >> Int_val(v2)); }
91c6a95
 
91c6a95
 CAMLprim value caml_int32_shift_right_unsigned(value v1, value v2)
91c6a95
-{ return caml_copy_int32((uint32)Int32_val(v1) >> Int_val(v2)); }
91c6a95
+{ return caml_copy_int32((uint32_t)Int32_val(v1) >> Int_val(v2)); }
91c6a95
 
91c6a95
-static int32 caml_swap32(int32 x)
91c6a95
+static int32_t caml_swap32(int32_t x)
91c6a95
 {
91c6a95
   return (((x & 0x000000FF) << 24) |
91c6a95
           ((x & 0x0000FF00) << 8) |
91c6a95
@@ -285,15 +285,15 @@ CAMLprim value caml_int32_to_int(value v)
91c6a95
 { return Val_long(Int32_val(v)); }
91c6a95
 
91c6a95
 CAMLprim value caml_int32_of_float(value v)
91c6a95
-{ return caml_copy_int32((int32)(Double_val(v))); }
91c6a95
+{ return caml_copy_int32((int32_t)(Double_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int32_to_float(value v)
91c6a95
 { return caml_copy_double((double)(Int32_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int32_compare(value v1, value v2)
91c6a95
 {
91c6a95
-  int32 i1 = Int32_val(v1);
91c6a95
-  int32 i2 = Int32_val(v2);
91c6a95
+  int32_t i1 = Int32_val(v1);
91c6a95
+  int32_t i2 = Int32_val(v2);
91c6a95
   int res = (i1 > i2) - (i1 < i2);
91c6a95
   return Val_int(res);
91c6a95
 }
91c6a95
@@ -313,14 +313,14 @@ CAMLprim value caml_int32_of_string(value s)
91c6a95
 
91c6a95
 CAMLprim value caml_int32_bits_of_float(value vd)
91c6a95
 {
91c6a95
-  union { float d; int32 i; } u;
91c6a95
+  union { float d; int32_t i; } u;
91c6a95
   u.d = Double_val(vd);
91c6a95
   return caml_copy_int32(u.i);
91c6a95
 }
91c6a95
 
91c6a95
 CAMLprim value caml_int32_float_of_bits(value vi)
91c6a95
 {
91c6a95
-  union { float d; int32 i; } u;
91c6a95
+  union { float d; int32_t i; } u;
91c6a95
   u.i = Int32_val(vi);
91c6a95
   return caml_copy_double(u.d);
91c6a95
 }
91c6a95
@@ -329,11 +329,11 @@ CAMLprim value caml_int32_float_of_bits(value vi)
91c6a95
 
91c6a95
 #ifdef ARCH_ALIGN_INT64
91c6a95
 
91c6a95
-CAMLexport int64 caml_Int64_val(value v)
91c6a95
+CAMLexport int64_t caml_Int64_val(value v)
91c6a95
 {
91c6a95
-  union { int32 i[2]; int64 j; } buffer;
91c6a95
-  buffer.i[0] = ((int32 *) Data_custom_val(v))[0];
91c6a95
-  buffer.i[1] = ((int32 *) Data_custom_val(v))[1];
91c6a95
+  union { int32_t i[2]; int64_t j; } buffer;
91c6a95
+  buffer.i[0] = ((int32_t *) Data_custom_val(v))[0];
91c6a95
+  buffer.i[1] = ((int32_t *) Data_custom_val(v))[1];
91c6a95
   return buffer.j;
91c6a95
 }
91c6a95
 
91c6a95
@@ -341,15 +341,15 @@ CAMLexport int64 caml_Int64_val(value v)
91c6a95
 
91c6a95
 static int int64_cmp(value v1, value v2)
91c6a95
 {
91c6a95
-  int64 i1 = Int64_val(v1);
91c6a95
-  int64 i2 = Int64_val(v2);
91c6a95
+  int64_t i1 = Int64_val(v1);
91c6a95
+  int64_t i2 = Int64_val(v2);
91c6a95
   return (i1 > i2) - (i1 < i2);
91c6a95
 }
91c6a95
 
91c6a95
 static intnat int64_hash(value v)
91c6a95
 {
91c6a95
-  int64 x = Int64_val(v);
91c6a95
-  uint32 lo = (uint32) x, hi = (uint32) (x >> 32);
91c6a95
+  int64_t x = Int64_val(v);
91c6a95
+  uint32_t lo = (uint32_t) x, hi = (uint32_t) (x >> 32);
91c6a95
   return hi ^ lo;
91c6a95
 }
91c6a95
 
91c6a95
@@ -363,12 +363,12 @@ static void int64_serialize(value v, uintnat * wsize_32,
91c6a95
 static uintnat int64_deserialize(void * dst)
91c6a95
 {
91c6a95
 #ifndef ARCH_ALIGN_INT64
91c6a95
-  *((int64 *) dst) = caml_deserialize_sint_8();
91c6a95
+  *((int64_t *) dst) = caml_deserialize_sint_8();
91c6a95
 #else
91c6a95
-  union { int32 i[2]; int64 j; } buffer;
91c6a95
+  union { int32_t i[2]; int64_t j; } buffer;
91c6a95
   buffer.j = caml_deserialize_sint_8();
91c6a95
-  ((int32 *) dst)[0] = buffer.i[0];
91c6a95
-  ((int32 *) dst)[1] = buffer.i[1];
91c6a95
+  ((int32_t *) dst)[0] = buffer.i[0];
91c6a95
+  ((int32_t *) dst)[1] = buffer.i[1];
91c6a95
 #endif
91c6a95
   return 8;
91c6a95
 }
91c6a95
@@ -383,16 +383,16 @@ CAMLexport struct custom_operations caml_int64_ops = {
91c6a95
   custom_compare_ext_default
91c6a95
 };
91c6a95
 
91c6a95
-CAMLexport value caml_copy_int64(int64 i)
91c6a95
+CAMLexport value caml_copy_int64(int64_t i)
91c6a95
 {
91c6a95
   value res = caml_alloc_custom(&caml_int64_ops, 8, 0, 1);
91c6a95
 #ifndef ARCH_ALIGN_INT64
91c6a95
   Int64_val(res) = i;
91c6a95
 #else
91c6a95
-  union { int32 i[2]; int64 j; } buffer;
91c6a95
+  union { int32_t i[2]; int64_t j; } buffer;
91c6a95
   buffer.j = i;
91c6a95
-  ((int32 *) Data_custom_val(res))[0] = buffer.i[0];
91c6a95
-  ((int32 *) Data_custom_val(res))[1] = buffer.i[1];
91c6a95
+  ((int32_t *) Data_custom_val(res))[0] = buffer.i[0];
91c6a95
+  ((int32_t *) Data_custom_val(res))[1] = buffer.i[1];
91c6a95
 #endif
91c6a95
   return res;
91c6a95
 }
91c6a95
@@ -413,23 +413,23 @@ CAMLprim value caml_int64_mul(value v1, value v2)
91c6a95
 
91c6a95
 CAMLprim value caml_int64_div(value v1, value v2)
91c6a95
 {
91c6a95
-  int64 dividend = Int64_val(v1);
91c6a95
-  int64 divisor = Int64_val(v2);
91c6a95
+  int64_t dividend = Int64_val(v1);
91c6a95
+  int64_t divisor = Int64_val(v2);
91c6a95
   if (divisor == 0) caml_raise_zero_divide();
91c6a95
   /* PR#4740: on some processors, division crashes on overflow.
91c6a95
      Implement the same behavior as for type "int". */
91c6a95
-  if (dividend == ((int64)1 << 63) && divisor == -1) return v1;
91c6a95
+  if (dividend == ((int64_t)1 << 63) && divisor == -1) return v1;
91c6a95
   return caml_copy_int64(Int64_val(v1) / divisor);
91c6a95
 }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_mod(value v1, value v2)
91c6a95
 {
91c6a95
-  int64 dividend = Int64_val(v1);
91c6a95
-  int64 divisor = Int64_val(v2);
91c6a95
+  int64_t dividend = Int64_val(v1);
91c6a95
+  int64_t divisor = Int64_val(v2);
91c6a95
   if (divisor == 0) caml_raise_zero_divide();
91c6a95
   /* PR#4740: on some processors, division crashes on overflow.
91c6a95
      Implement the same behavior as for type "int". */
91c6a95
-  if (dividend == ((int64)1 << 63) && divisor == -1) return caml_copy_int64(0);
91c6a95
+  if (dividend == ((int64_t)1 << 63) && divisor == -1) return caml_copy_int64(0);
91c6a95
   return caml_copy_int64(Int64_val(v1) % divisor);
91c6a95
 }
91c6a95
 
91c6a95
@@ -449,7 +449,7 @@ CAMLprim value caml_int64_shift_right(value v1, value v2)
91c6a95
 { return caml_copy_int64(Int64_val(v1) >> Int_val(v2)); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_shift_right_unsigned(value v1, value v2)
91c6a95
-{ return caml_copy_int64((uint64) (Int64_val(v1)) >>  Int_val(v2)); }
91c6a95
+{ return caml_copy_int64((uint64_t) (Int64_val(v1)) >>  Int_val(v2)); }
91c6a95
 
91c6a95
 #ifdef ARCH_SIXTYFOUR
91c6a95
 static value caml_swap64(value x)
91c6a95
@@ -470,7 +470,7 @@ value caml_int64_direct_bswap(value v)
91c6a95
 
91c6a95
 CAMLprim value caml_int64_bswap(value v)
91c6a95
 {
91c6a95
-  int64 x = Int64_val(v);
91c6a95
+  int64_t x = Int64_val(v);
91c6a95
   return caml_copy_int64
91c6a95
     (((x & 0x00000000000000FFULL) << 56) |
91c6a95
      ((x & 0x000000000000FF00ULL) << 40) |
91c6a95
@@ -483,33 +483,33 @@ CAMLprim value caml_int64_bswap(value v)
91c6a95
 }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_of_int(value v)
91c6a95
-{ return caml_copy_int64((int64) (Long_val(v))); }
91c6a95
+{ return caml_copy_int64((int64_t) (Long_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_to_int(value v)
91c6a95
 { return Val_long((intnat) (Int64_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_of_float(value v)
91c6a95
-{ return caml_copy_int64((int64) (Double_val(v))); }
91c6a95
+{ return caml_copy_int64((int64_t) (Double_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_to_float(value v)
91c6a95
 { return caml_copy_double((double) (Int64_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_of_int32(value v)
91c6a95
-{ return caml_copy_int64((int64) (Int32_val(v))); }
91c6a95
+{ return caml_copy_int64((int64_t) (Int32_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_to_int32(value v)
91c6a95
-{ return caml_copy_int32((int32) (Int64_val(v))); }
91c6a95
+{ return caml_copy_int32((int32_t) (Int64_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_of_nativeint(value v)
91c6a95
-{ return caml_copy_int64((int64) (Nativeint_val(v))); }
91c6a95
+{ return caml_copy_int64((int64_t) (Nativeint_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_to_nativeint(value v)
91c6a95
 { return caml_copy_nativeint((intnat) (Int64_val(v))); }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_compare(value v1, value v2)
91c6a95
 {
91c6a95
-  int64 i1 = Int64_val(v1);
91c6a95
-  int64 i2 = Int64_val(v2);
91c6a95
+  int64_t i1 = Int64_val(v1);
91c6a95
+  int64_t i2 = Int64_val(v2);
91c6a95
   return Val_int((i1 > i2) - (i1 < i2));
91c6a95
 }
91c6a95
 
91c6a95
@@ -524,11 +524,11 @@ CAMLprim value caml_int64_format(value fmt, value arg)
91c6a95
 CAMLprim value caml_int64_of_string(value s)
91c6a95
 {
91c6a95
   char * p;
91c6a95
-  uint64 res, threshold;
91c6a95
+  uint64_t res, threshold;
91c6a95
   int sign, base, d;
91c6a95
 
91c6a95
   p = parse_sign_and_base(String_val(s), &base, &sign;;
91c6a95
-  threshold = ((uint64) -1) / base;
91c6a95
+  threshold = ((uint64_t) -1) / base;
91c6a95
   d = parse_digit(*p);
91c6a95
   if (d < 0 || d >= base) caml_failwith("int_of_string");
91c6a95
   res = d;
91c6a95
@@ -541,7 +541,7 @@ CAMLprim value caml_int64_of_string(value s)
91c6a95
     if (res > threshold) caml_failwith("int_of_string");
91c6a95
     res = base * res + d;
91c6a95
     /* Detect overflow in addition (base * res) + d */
91c6a95
-    if (res < (uint64) d) caml_failwith("int_of_string");
91c6a95
+    if (res < (uint64_t) d) caml_failwith("int_of_string");
91c6a95
   }
91c6a95
   if (p != String_val(s) + caml_string_length(s)){
91c6a95
     caml_failwith("int_of_string");
91c6a95
@@ -549,9 +549,9 @@ CAMLprim value caml_int64_of_string(value s)
91c6a95
   if (base == 10) {
91c6a95
     /* Signed representation expected, allow -2^63 to 2^63 - 1 only */
91c6a95
     if (sign >= 0) {
91c6a95
-      if (res >= (uint64)1 << 63) caml_failwith("int_of_string");
91c6a95
+      if (res >= (uint64_t)1 << 63) caml_failwith("int_of_string");
91c6a95
     } else {
91c6a95
-      if (res >  (uint64)1 << 63) caml_failwith("int_of_string");
91c6a95
+      if (res >  (uint64_t)1 << 63) caml_failwith("int_of_string");
91c6a95
     }
91c6a95
   }
91c6a95
   if (sign < 0) res = - res;
91c6a95
@@ -560,20 +560,20 @@ CAMLprim value caml_int64_of_string(value s)
91c6a95
 
91c6a95
 CAMLprim value caml_int64_bits_of_float(value vd)
91c6a95
 {
91c6a95
-  union { double d; int64 i; int32 h[2]; } u;
91c6a95
+  union { double d; int64_t i; int32_t h[2]; } u;
91c6a95
   u.d = Double_val(vd);
91c6a95
 #if defined(__arm__) && !defined(__ARM_EABI__)
91c6a95
-  { int32 t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
91c6a95
+  { int32_t t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
91c6a95
 #endif
91c6a95
   return caml_copy_int64(u.i);
91c6a95
 }
91c6a95
 
91c6a95
 CAMLprim value caml_int64_float_of_bits(value vi)
91c6a95
 {
91c6a95
-  union { double d; int64 i; int32 h[2]; } u;
91c6a95
+  union { double d; int64_t i; int32_t h[2]; } u;
91c6a95
   u.i = Int64_val(vi);
91c6a95
 #if defined(__arm__) && !defined(__ARM_EABI__)
91c6a95
-  { int32 t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
91c6a95
+  { int32_t t = u.h[0]; u.h[0] = u.h[1]; u.h[1] = t; }
91c6a95
 #endif
91c6a95
   return caml_copy_double(u.d);
91c6a95
 }
91c6a95
@@ -606,7 +606,7 @@ static void nativeint_serialize(value v, uintnat * wsize_32,
91c6a95
 #ifdef ARCH_SIXTYFOUR
91c6a95
   if (l >= -((intnat)1 << 31) && l < ((intnat)1 << 31)) {
91c6a95
     caml_serialize_int_1(1);
91c6a95
-    caml_serialize_int_4((int32) l);
91c6a95
+    caml_serialize_int_4((int32_t) l);
91c6a95
   } else {
91c6a95
     caml_serialize_int_1(2);
91c6a95
     caml_serialize_int_8(l);
91c6a95
diff --git a/byterun/io.c b/byterun/io.c
91c6a95
index 5f04a96..bedc0f0 100644
91c6a95
--- a/byterun/io.c
91c6a95
+++ b/byterun/io.c
91c6a95
@@ -207,7 +207,7 @@ CAMLexport void caml_flush(struct channel *channel)
91c6a95
 
91c6a95
 /* Output data */
91c6a95
 
91c6a95
-CAMLexport void caml_putword(struct channel *channel, uint32 w)
91c6a95
+CAMLexport void caml_putword(struct channel *channel, uint32_t w)
91c6a95
 {
91c6a95
   if (! caml_channel_binary_mode(channel))
91c6a95
     caml_failwith("output_binary_int: not a binary channel");
91c6a95
@@ -303,10 +303,10 @@ CAMLexport unsigned char caml_refill(struct channel *channel)
91c6a95
   return (unsigned char)(channel->buff[0]);
91c6a95
 }
91c6a95
 
91c6a95
-CAMLexport uint32 caml_getword(struct channel *channel)
91c6a95
+CAMLexport uint32_t caml_getword(struct channel *channel)
91c6a95
 {
91c6a95
   int i;
91c6a95
-  uint32 res;
91c6a95
+  uint32_t res;
91c6a95
 
91c6a95
   if (! caml_channel_binary_mode(channel))
91c6a95
     caml_failwith("input_binary_int: not a binary channel");
91c6a95
diff --git a/byterun/io.h b/byterun/io.h
91c6a95
index 64a8bf5..5a9c037 100644
91c6a95
--- a/byterun/io.h
91c6a95
+++ b/byterun/io.h
91c6a95
@@ -78,12 +78,12 @@ CAMLextern value caml_alloc_channel(struct channel *chan);
91c6a95
 
91c6a95
 CAMLextern int caml_flush_partial (struct channel *);
91c6a95
 CAMLextern void caml_flush (struct channel *);
91c6a95
-CAMLextern void caml_putword (struct channel *, uint32);
91c6a95
+CAMLextern void caml_putword (struct channel *, uint32_t);
91c6a95
 CAMLextern int caml_putblock (struct channel *, char *, intnat);
91c6a95
 CAMLextern void caml_really_putblock (struct channel *, char *, intnat);
91c6a95
 
91c6a95
 CAMLextern unsigned char caml_refill (struct channel *);
91c6a95
-CAMLextern uint32 caml_getword (struct channel *);
91c6a95
+CAMLextern uint32_t caml_getword (struct channel *);
91c6a95
 CAMLextern int caml_getblock (struct channel *, char *, intnat);
91c6a95
 CAMLextern int caml_really_getblock (struct channel *, char *, intnat);
91c6a95
 
91c6a95
@@ -107,7 +107,7 @@ CAMLextern struct channel * caml_all_opened_channels;
91c6a95
 #define Unlock_exn() \
91c6a95
   if (caml_channel_mutex_unlock_exn != NULL) (*caml_channel_mutex_unlock_exn)()
91c6a95
 
91c6a95
-/* Conversion between file_offset and int64 */
91c6a95
+/* Conversion between file_offset and int64_t */
91c6a95
 
91c6a95
 #define Val_file_offset(fofs) caml_copy_int64(fofs)
91c6a95
 #define File_offset_val(v) ((file_offset) Int64_val(v))
91c6a95
diff --git a/byterun/md5.c b/byterun/md5.c
91c6a95
index 10ac76a..2dc90a2 100644
91c6a95
--- a/byterun/md5.c
91c6a95
+++ b/byterun/md5.c
91c6a95
@@ -97,11 +97,11 @@ CAMLexport void caml_md5_block(unsigned char digest[16],
91c6a95
 #else
91c6a95
 static void byteReverse(unsigned char * buf, unsigned longs)
91c6a95
 {
91c6a95
-    uint32 t;
91c6a95
+    uint32_t t;
91c6a95
     do {
91c6a95
-        t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
91c6a95
+        t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
91c6a95
             ((unsigned) buf[1] << 8 | buf[0]);
91c6a95
-        *(uint32 *) buf = t;
91c6a95
+        *(uint32_t *) buf = t;
91c6a95
         buf += 4;
91c6a95
     } while (--longs);
91c6a95
 }
91c6a95
@@ -129,12 +129,12 @@ CAMLexport void caml_MD5Init(struct MD5Context *ctx)
91c6a95
 CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf,
91c6a95
                                uintnat len)
91c6a95
 {
91c6a95
-    uint32 t;
91c6a95
+    uint32_t t;
91c6a95
 
91c6a95
     /* Update bitcount */
91c6a95
 
91c6a95
     t = ctx->bits[0];
91c6a95
-    if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
91c6a95
+    if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
91c6a95
         ctx->bits[1]++;         /* Carry from low to high */
91c6a95
     ctx->bits[1] += len >> 29;
91c6a95
 
91c6a95
@@ -152,7 +152,7 @@ CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf,
91c6a95
         }
91c6a95
         memcpy(p, buf, t);
91c6a95
         byteReverse(ctx->in, 16);
91c6a95
-        caml_MD5Transform(ctx->buf, (uint32 *) ctx->in);
91c6a95
+        caml_MD5Transform(ctx->buf, (uint32_t *) ctx->in);
91c6a95
         buf += t;
91c6a95
         len -= t;
91c6a95
     }
91c6a95
@@ -161,7 +161,7 @@ CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf,
91c6a95
     while (len >= 64) {
91c6a95
         memcpy(ctx->in, buf, 64);
91c6a95
         byteReverse(ctx->in, 16);
91c6a95
-        caml_MD5Transform(ctx->buf, (uint32 *) ctx->in);
91c6a95
+        caml_MD5Transform(ctx->buf, (uint32_t *) ctx->in);
91c6a95
         buf += 64;
91c6a95
         len -= 64;
91c6a95
     }
91c6a95
@@ -196,7 +196,7 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx)
91c6a95
         /* Two lots of padding:  Pad the first block to 64 bytes */
91c6a95
         memset(p, 0, count);
91c6a95
         byteReverse(ctx->in, 16);
91c6a95
-        caml_MD5Transform(ctx->buf, (uint32 *) ctx->in);
91c6a95
+        caml_MD5Transform(ctx->buf, (uint32_t *) ctx->in);
91c6a95
 
91c6a95
         /* Now fill the next block with 56 bytes */
91c6a95
         memset(ctx->in, 0, 56);
91c6a95
@@ -207,10 +207,10 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx)
91c6a95
     byteReverse(ctx->in, 14);
91c6a95
 
91c6a95
     /* Append length in bits and transform */
91c6a95
-    ((uint32 *) ctx->in)[14] = ctx->bits[0];
91c6a95
-    ((uint32 *) ctx->in)[15] = ctx->bits[1];
91c6a95
+    ((uint32_t *) ctx->in)[14] = ctx->bits[0];
91c6a95
+    ((uint32_t *) ctx->in)[15] = ctx->bits[1];
91c6a95
 
91c6a95
-    caml_MD5Transform(ctx->buf, (uint32 *) ctx->in);
91c6a95
+    caml_MD5Transform(ctx->buf, (uint32_t *) ctx->in);
91c6a95
     byteReverse((unsigned char *) ctx->buf, 4);
91c6a95
     memcpy(digest, ctx->buf, 16);
91c6a95
     memset(ctx, 0, sizeof(*ctx));        /* In case it's sensitive */
91c6a95
@@ -233,9 +233,9 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx)
91c6a95
  * reflect the addition of 16 longwords of new data.  caml_MD5Update blocks
91c6a95
  * the data and converts bytes into longwords for this routine.
91c6a95
  */
91c6a95
-CAMLexport void caml_MD5Transform(uint32 *buf, uint32 *in)
91c6a95
+CAMLexport void caml_MD5Transform(uint32_t *buf, uint32_t *in)
91c6a95
 {
91c6a95
-    register uint32 a, b, c, d;
91c6a95
+    register uint32_t a, b, c, d;
91c6a95
 
91c6a95
     a = buf[0];
91c6a95
     b = buf[1];
91c6a95
diff --git a/byterun/md5.h b/byterun/md5.h
91c6a95
index d8aff09..f63667d 100644
91c6a95
--- a/byterun/md5.h
91c6a95
+++ b/byterun/md5.h
91c6a95
@@ -26,8 +26,8 @@ CAMLextern void caml_md5_block(unsigned char digest[16],
91c6a95
                                void * data, uintnat len);
91c6a95
 
91c6a95
 struct MD5Context {
91c6a95
-        uint32 buf[4];
91c6a95
-        uint32 bits[2];
91c6a95
+        uint32_t buf[4];
91c6a95
+        uint32_t bits[2];
91c6a95
         unsigned char in[64];
91c6a95
 };
91c6a95
 
91c6a95
@@ -35,7 +35,7 @@ CAMLextern void caml_MD5Init (struct MD5Context *context);
91c6a95
 CAMLextern void caml_MD5Update (struct MD5Context *context, unsigned char *buf,
91c6a95
                                 uintnat len);
91c6a95
 CAMLextern void caml_MD5Final (unsigned char *digest, struct MD5Context *ctx);
91c6a95
-CAMLextern void caml_MD5Transform (uint32 *buf, uint32 *in);
91c6a95
+CAMLextern void caml_MD5Transform (uint32_t *buf, uint32_t *in);
91c6a95
 
91c6a95
 
91c6a95
 #endif /* CAML_MD5_H */
91c6a95
diff --git a/byterun/mlvalues.h b/byterun/mlvalues.h
91c6a95
index 268bcfe..a08948e 100644
91c6a95
--- a/byterun/mlvalues.h
91c6a95
+++ b/byterun/mlvalues.h
91c6a95
@@ -38,8 +38,8 @@ extern "C" {
91c6a95
   bp: Pointer to the first byte of a block.  (a char *)
91c6a95
   op: Pointer to the first field of a block.  (a value *)
91c6a95
   hp: Pointer to the header of a block.  (a char *)
91c6a95
-  int32: Four bytes on all architectures.
91c6a95
-  int64: Eight bytes on all architectures.
91c6a95
+  int32_t: Four bytes on all architectures.
91c6a95
+  int64_t: Eight bytes on all architectures.
91c6a95
 
91c6a95
   Remark: A block size is always a multiple of the word size, and at least
91c6a95
           one word plus the header.
91c6a95
@@ -161,7 +161,7 @@ bits  63    10 9     8 7   0
91c6a95
 /* Fields are numbered from 0. */
91c6a95
 #define Field(x, i) (((value *)(x)) [i])           /* Also an l-value. */
91c6a95
 
91c6a95
-typedef int32 opcode_t;
91c6a95
+typedef int32_t opcode_t;
91c6a95
 typedef opcode_t * code_t;
91c6a95
 
91c6a95
 /* NOTE: [Forward_tag] and [Infix_tag] must be just under
91c6a95
@@ -262,12 +262,12 @@ struct custom_operations;       /* defined in [custom.h] */
91c6a95
 
91c6a95
 /* Int32.t, Int64.t and Nativeint.t are represented as custom blocks. */
91c6a95
 
91c6a95
-#define Int32_val(v) (*((int32 *) Data_custom_val(v)))
91c6a95
+#define Int32_val(v) (*((int32_t *) Data_custom_val(v)))
91c6a95
 #define Nativeint_val(v) (*((intnat *) Data_custom_val(v)))
91c6a95
 #ifndef ARCH_ALIGN_INT64
91c6a95
-#define Int64_val(v) (*((int64 *) Data_custom_val(v)))
91c6a95
+#define Int64_val(v) (*((int64_t *) Data_custom_val(v)))
91c6a95
 #else
91c6a95
-CAMLextern int64 caml_Int64_val(value v);
91c6a95
+CAMLextern int64_t caml_Int64_val(value v);
91c6a95
 #define Int64_val(v) caml_Int64_val(v)
91c6a95
 #endif
91c6a95
 
91c6a95
diff --git a/byterun/startup.c b/byterun/startup.c
91c6a95
index 3697220..ab926ef 100644
91c6a95
--- a/byterun/startup.c
91c6a95
+++ b/byterun/startup.c
91c6a95
@@ -79,7 +79,7 @@ static void init_atoms(void)
91c6a95
 
91c6a95
 /* Read the trailer of a bytecode file */
91c6a95
 
91c6a95
-static void fixup_endianness_trailer(uint32 * p)
91c6a95
+static void fixup_endianness_trailer(uint32_t * p)
91c6a95
 {
91c6a95
 #ifndef ARCH_BIG_ENDIAN
91c6a95
   Reverse_32(p, p);
91c6a95
@@ -153,7 +153,7 @@ void caml_read_section_descriptors(int fd, struct exec_trailer *trail)
91c6a95
    Return the length of the section data in bytes, or -1 if no section
91c6a95
    found with that name. */
91c6a95
 
91c6a95
-int32 caml_seek_optional_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
+int32_t caml_seek_optional_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
 {
91c6a95
   long ofs;
91c6a95
   int i;
91c6a95
@@ -172,9 +172,9 @@ int32 caml_seek_optional_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
 /* Position fd at the beginning of the section having the given name.
91c6a95
    Return the length of the section data in bytes. */
91c6a95
 
91c6a95
-int32 caml_seek_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
+int32_t caml_seek_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
 {
91c6a95
-  int32 len = caml_seek_optional_section(fd, trail, name);
91c6a95
+  int32_t len = caml_seek_optional_section(fd, trail, name);
91c6a95
   if (len == -1)
91c6a95
     caml_fatal_error_arg("Fatal_error: section `%s' is missing\n", name);
91c6a95
   return len;
91c6a95
@@ -185,7 +185,7 @@ int32 caml_seek_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
 
91c6a95
 static char * read_section(int fd, struct exec_trailer *trail, char *name)
91c6a95
 {
91c6a95
-  int32 len;
91c6a95
+  int32_t len;
91c6a95
   char * data;
91c6a95
 
91c6a95
   len = caml_seek_optional_section(fd, trail, name);
91c6a95
diff --git a/byterun/startup.h b/byterun/startup.h
91c6a95
index 3dda64b..3268d88 100644
91c6a95
--- a/byterun/startup.h
91c6a95
+++ b/byterun/startup.h
91c6a95
@@ -30,9 +30,9 @@ enum { FILE_NOT_FOUND = -1, BAD_BYTECODE  = -2 };
91c6a95
 extern int caml_attempt_open(char **name, struct exec_trailer *trail,
91c6a95
                              int do_open_script);
91c6a95
 extern void caml_read_section_descriptors(int fd, struct exec_trailer *trail);
91c6a95
-extern int32 caml_seek_optional_section(int fd, struct exec_trailer *trail,
91c6a95
+extern int32_t caml_seek_optional_section(int fd, struct exec_trailer *trail,
91c6a95
                                         char *name);
91c6a95
-extern int32 caml_seek_section(int fd, struct exec_trailer *trail, char *name);
91c6a95
+extern int32_t caml_seek_section(int fd, struct exec_trailer *trail, char *name);
91c6a95
 
91c6a95
 
91c6a95
 #endif /* CAML_STARTUP_H */
91c6a95
diff --git a/byterun/str.c b/byterun/str.c
91c6a95
index 6effa91..9c7baa1 100644
91c6a95
--- a/byterun/str.c
91c6a95
+++ b/byterun/str.c
91c6a95
@@ -101,7 +101,7 @@ CAMLprim value caml_string_get32(value str, value index)
91c6a95
 
91c6a95
 CAMLprim value caml_string_get64(value str, value index)
91c6a95
 {
91c6a95
-  uint64 res;
91c6a95
+  uint64_t res;
91c6a95
   unsigned char b1, b2, b3, b4, b5, b6, b7, b8;
91c6a95
   intnat idx = Long_val(index);
91c6a95
   if (idx < 0 || idx + 7 >= caml_string_length(str)) caml_array_bound_error();
91c6a95
@@ -114,15 +114,15 @@ CAMLprim value caml_string_get64(value str, value index)
91c6a95
   b7 = Byte_u(str, idx + 6);
91c6a95
   b8 = Byte_u(str, idx + 7);
91c6a95
 #ifdef ARCH_BIG_ENDIAN
91c6a95
-  res = (uint64) b1 << 56 | (uint64) b2 << 48
91c6a95
-        | (uint64) b3 << 40 | (uint64) b4 << 32
91c6a95
-        | (uint64) b5 << 24 | (uint64) b6 << 16
91c6a95
-        | (uint64) b7 << 8 | (uint64) b8;
91c6a95
+  res = (uint64_t) b1 << 56 | (uint64_t) b2 << 48
91c6a95
+        | (uint64_t) b3 << 40 | (uint64_t) b4 << 32
91c6a95
+        | (uint64_t) b5 << 24 | (uint64_t) b6 << 16
91c6a95
+        | (uint64_t) b7 << 8 | (uint64_t) b8;
91c6a95
 #else
91c6a95
-  res = (uint64) b8 << 56 | (uint64) b7 << 48
91c6a95
-        | (uint64) b6 << 40 | (uint64) b5 << 32
91c6a95
-        | (uint64) b4 << 24 | (uint64) b3 << 16
91c6a95
-        | (uint64) b2 << 8 | (uint64) b1;
91c6a95
+  res = (uint64_t) b8 << 56 | (uint64_t) b7 << 48
91c6a95
+        | (uint64_t) b6 << 40 | (uint64_t) b5 << 32
91c6a95
+        | (uint64_t) b4 << 24 | (uint64_t) b3 << 16
91c6a95
+        | (uint64_t) b2 << 8 | (uint64_t) b1;
91c6a95
 #endif
91c6a95
   return caml_copy_int64(res);
91c6a95
 }
91c6a95
@@ -174,7 +174,7 @@ CAMLprim value caml_string_set32(value str, value index, value newval)
91c6a95
 CAMLprim value caml_string_set64(value str, value index, value newval)
91c6a95
 {
91c6a95
   unsigned char b1, b2, b3, b4, b5, b6, b7, b8;
91c6a95
-  int64 val;
91c6a95
+  int64_t val;
91c6a95
   intnat idx = Long_val(index);
91c6a95
   if (idx < 0 || idx + 7 >= caml_string_length(str)) caml_array_bound_error();
91c6a95
   val = Int64_val(newval);
91c6a95
diff --git a/config/auto-aux/int64align.c b/config/auto-aux/int64align.c
91c6a95
index 5795e48..c143986 100644
91c6a95
--- a/config/auto-aux/int64align.c
91c6a95
+++ b/config/auto-aux/int64align.c
91c6a95
@@ -17,18 +17,18 @@
91c6a95
 #include "m.h"
91c6a95
 
91c6a95
 #if defined(ARCH_INT64_TYPE)
91c6a95
-typedef ARCH_INT64_TYPE int64;
91c6a95
+typedef ARCH_INT64_TYPE int64_t;
91c6a95
 #elif SIZEOF_LONG == 8
91c6a95
-typedef long int64;
91c6a95
+typedef long int64_t;
91c6a95
 #elif SIZEOF_LONGLONG == 8
91c6a95
-typedef long long int64;
91c6a95
+typedef long long int64_t;
91c6a95
 #else
91c6a95
 #error "No 64-bit integer type available"
91c6a95
 #endif
91c6a95
 
91c6a95
-int64 foo;
91c6a95
+int64_t foo;
91c6a95
 
91c6a95
-void access_int64(int64 *p)
91c6a95
+void access_int64(int64_t *p)
91c6a95
 {
91c6a95
   foo = *p;
91c6a95
 }
91c6a95
@@ -49,8 +49,8 @@ int main(void)
91c6a95
   signal(SIGBUS, sig_handler);
91c6a95
 #endif
91c6a95
   if(setjmp(failure) == 0) {
91c6a95
-    access_int64((int64 *) n);
91c6a95
-    access_int64((int64 *) (n+1));
91c6a95
+    access_int64((int64_t *) n);
91c6a95
+    access_int64((int64_t *) (n+1));
91c6a95
     res = 0;
91c6a95
   } else {
91c6a95
     res = 1;
91c6a95
diff --git a/config/s-nt.h b/config/s-nt.h
91c6a95
index 6df440b..603b050 100644
91c6a95
--- a/config/s-nt.h
91c6a95
+++ b/config/s-nt.h
91c6a95
@@ -15,6 +15,9 @@
91c6a95
 
91c6a95
 #define OCAML_OS_TYPE "Win32"
91c6a95
 
91c6a95
+#ifdef __MINGW32__
91c6a95
+#define HAS_STDINT_H
91c6a95
+#endif
91c6a95
 #undef BSD_SIGNALS
91c6a95
 #define HAS_STRERROR
91c6a95
 #define HAS_SOCKETS
91c6a95
diff --git a/configure b/configure
91c6a95
index 0bf4ebd..8a9be78 100755
91c6a95
--- a/configure
91c6a95
+++ b/configure
91c6a95
@@ -615,26 +615,6 @@ case "$target" in
91c6a95
     esac
91c6a95
 esac
91c6a95
 
91c6a95
-# Check semantics of division and modulus
91c6a95
-
91c6a95
-sh ./runtest divmod.c
91c6a95
-case $? in
91c6a95
-  0) inf "Native division and modulus have round-towards-zero semantics," \
91c6a95
-         "will use them."
91c6a95
-     echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
91c6a95
-  1) inf "Native division and modulus do not have round-towards-zero"
91c6a95
-         "semantics, will use software emulation."
91c6a95
-     echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
91c6a95
-  *) case $target in
91c6a95
-       *-*-mingw*) inf "Native division and modulus have round-towards-zero" \
91c6a95
-                       "semantics, will use them."
91c6a95
-                   echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
91c6a95
-       *) wrn "Something went wrong while checking native division and modulus"\
91c6a95
-              "please report it at http://http://caml.inria.fr/mantis/"
91c6a95
-          echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
91c6a95
-     esac;;
91c6a95
-esac
91c6a95
-
91c6a95
 # Shared library support
91c6a95
 
91c6a95
 shared_libraries_supported=false
91c6a95
@@ -1085,6 +1065,11 @@ if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
91c6a95
   echo "#define HAS_IPV6" >> s.h
91c6a95
 fi
91c6a95
 
91c6a95
+if sh ./hasgot -i stdint.h; then
91c6a95
+  inf "stdint.h found."
91c6a95
+  echo "#define HAS_STDINT_H" >> s.h
91c6a95
+fi
91c6a95
+
91c6a95
 if sh ./hasgot -i unistd.h; then
91c6a95
   inf "unistd.h found."
91c6a95
   echo "#define HAS_UNISTD" >> s.h
91c6a95
diff --git a/otherlibs/bigarray/bigarray_stubs.c b/otherlibs/bigarray/bigarray_stubs.c
91c6a95
index 7e63cbf..f2ccb92 100644
91c6a95
--- a/otherlibs/bigarray/bigarray_stubs.c
91c6a95
+++ b/otherlibs/bigarray/bigarray_stubs.c
91c6a95
@@ -279,9 +279,9 @@ value caml_ba_get_N(value vb, value * vind, int nind)
91c6a95
   case CAML_BA_UINT16:
91c6a95
     return Val_int(((uint16 *) b->data)[offset]);
91c6a95
   case CAML_BA_INT32:
91c6a95
-    return caml_copy_int32(((int32 *) b->data)[offset]);
91c6a95
+    return caml_copy_int32(((int32_t *) b->data)[offset]);
91c6a95
   case CAML_BA_INT64:
91c6a95
-    return caml_copy_int64(((int64 *) b->data)[offset]);
91c6a95
+    return caml_copy_int64(((int64_t *) b->data)[offset]);
91c6a95
   case CAML_BA_NATIVE_INT:
91c6a95
     return caml_copy_nativeint(((intnat *) b->data)[offset]);
91c6a95
   case CAML_BA_CAML_INT:
91c6a95
@@ -388,7 +388,7 @@ CAMLprim value caml_ba_uint8_get32(value vb, value vind)
91c6a95
 
91c6a95
 CAMLprim value caml_ba_uint8_get64(value vb, value vind)
91c6a95
 {
91c6a95
-  uint64 res;
91c6a95
+  uint64_t res;
91c6a95
   unsigned char b1, b2, b3, b4, b5, b6, b7, b8;
91c6a95
   intnat idx = Long_val(vind);
91c6a95
   struct caml_ba_array * b = Caml_ba_array_val(vb);
91c6a95
@@ -402,15 +402,15 @@ CAMLprim value caml_ba_uint8_get64(value vb, value vind)
91c6a95
   b7 = ((unsigned char*) b->data)[idx+6];
91c6a95
   b8 = ((unsigned char*) b->data)[idx+7];
91c6a95
 #ifdef ARCH_BIG_ENDIAN
91c6a95
-  res = (uint64) b1 << 56 | (uint64) b2 << 48
91c6a95
-        | (uint64) b3 << 40 | (uint64) b4 << 32
91c6a95
-        | (uint64) b5 << 24 | (uint64) b6 << 16
91c6a95
-        | (uint64) b7 << 8 | (uint64) b8;
91c6a95
+  res = (uint64_t) b1 << 56 | (uint64_t) b2 << 48
91c6a95
+        | (uint64_t) b3 << 40 | (uint64_t) b4 << 32
91c6a95
+        | (uint64_t) b5 << 24 | (uint64_t) b6 << 16
91c6a95
+        | (uint64_t) b7 << 8 | (uint64_t) b8;
91c6a95
 #else
91c6a95
-  res = (uint64) b8 << 56 | (uint64) b7 << 48
91c6a95
-        | (uint64) b6 << 40 | (uint64) b5 << 32
91c6a95
-        | (uint64) b4 << 24 | (uint64) b3 << 16
91c6a95
-        | (uint64) b2 << 8 | (uint64) b1;
91c6a95
+  res = (uint64_t) b8 << 56 | (uint64_t) b7 << 48
91c6a95
+        | (uint64_t) b6 << 40 | (uint64_t) b5 << 32
91c6a95
+        | (uint64_t) b4 << 24 | (uint64_t) b3 << 16
91c6a95
+        | (uint64_t) b2 << 8 | (uint64_t) b1;
91c6a95
 #endif
91c6a95
   return caml_copy_int64(res);
91c6a95
 }
91c6a95
@@ -447,9 +447,9 @@ static value caml_ba_set_aux(value vb, value * vind, intnat nind, value newval)
91c6a95
   case CAML_BA_UINT16:
91c6a95
     ((int16 *) b->data)[offset] = Int_val(newval); break;
91c6a95
   case CAML_BA_INT32:
91c6a95
-    ((int32 *) b->data)[offset] = Int32_val(newval); break;
91c6a95
+    ((int32_t *) b->data)[offset] = Int32_val(newval); break;
91c6a95
   case CAML_BA_INT64:
91c6a95
-    ((int64 *) b->data)[offset] = Int64_val(newval); break;
91c6a95
+    ((int64_t *) b->data)[offset] = Int64_val(newval); break;
91c6a95
   case CAML_BA_NATIVE_INT:
91c6a95
     ((intnat *) b->data)[offset] = Nativeint_val(newval); break;
91c6a95
   case CAML_BA_CAML_INT:
91c6a95
@@ -577,7 +577,7 @@ CAMLprim value caml_ba_uint8_set64(value vb, value vind, value newval)
91c6a95
 {
91c6a95
   unsigned char b1, b2, b3, b4, b5, b6, b7, b8;
91c6a95
   intnat idx = Long_val(vind);
91c6a95
-  int64 val;
91c6a95
+  int64_t val;
91c6a95
   struct caml_ba_array * b = Caml_ba_array_val(vb);
91c6a95
   if (idx < 0 || idx >= b->dim[0] - 7) caml_array_bound_error();
91c6a95
   val = Int64_val(newval);
91c6a95
@@ -760,9 +760,9 @@ static int caml_ba_compare(value v1, value v2)
91c6a95
   case CAML_BA_UINT16:
91c6a95
     DO_INTEGER_COMPARISON(uint16);
91c6a95
   case CAML_BA_INT32:
91c6a95
-    DO_INTEGER_COMPARISON(int32);
91c6a95
+    DO_INTEGER_COMPARISON(int32_t);
91c6a95
   case CAML_BA_INT64:
91c6a95
-    DO_INTEGER_COMPARISON(int64);
91c6a95
+    DO_INTEGER_COMPARISON(int64_t);
91c6a95
   case CAML_BA_CAML_INT:
91c6a95
   case CAML_BA_NATIVE_INT:
91c6a95
     DO_INTEGER_COMPARISON(intnat);
91c6a95
@@ -780,7 +780,7 @@ static intnat caml_ba_hash(value v)
91c6a95
 {
91c6a95
   struct caml_ba_array * b = Caml_ba_array_val(v);
91c6a95
   intnat num_elts, n;
91c6a95
-  uint32 h, w;
91c6a95
+  uint32_t h, w;
91c6a95
   int i;
91c6a95
 
91c6a95
   num_elts = 1;
91c6a95
@@ -820,7 +820,7 @@ static intnat caml_ba_hash(value v)
91c6a95
   }
91c6a95
   case CAML_BA_INT32:
91c6a95
   {
91c6a95
-    uint32 * p = b->data;
91c6a95
+    uint32_t * p = b->data;
91c6a95
     if (num_elts > 64) num_elts = 64;
91c6a95
     for (n = 0; n < num_elts; n++, p++) h = caml_hash_mix_uint32(h, *p);
91c6a95
     break;
91c6a95
@@ -835,7 +835,7 @@ static intnat caml_ba_hash(value v)
91c6a95
   }
91c6a95
   case CAML_BA_INT64:
91c6a95
   {
91c6a95
-    int64 * p = b->data;
91c6a95
+    int64_t * p = b->data;
91c6a95
     if (num_elts > 32) num_elts = 32;
91c6a95
     for (n = 0; n < num_elts; n++, p++) h = caml_hash_mix_int64(h, *p);
91c6a95
     break;
91c6a95
@@ -878,7 +878,7 @@ static void caml_ba_serialize_longarray(void * data,
91c6a95
   } else {
91c6a95
     caml_serialize_int_1(0);
91c6a95
     for (n = 0, p = data; n < num_elts; n++, p++)
91c6a95
-      caml_serialize_int_4((int32) *p);
91c6a95
+      caml_serialize_int_4((int32_t) *p);
91c6a95
   }
91c6a95
 #else
91c6a95
   caml_serialize_int_1(0);
91c6a95
@@ -1181,14 +1181,14 @@ CAMLprim value caml_ba_fill(value vb, value vinit)
91c6a95
     break;
91c6a95
   }
91c6a95
   case CAML_BA_INT32: {
91c6a95
-    int32 init = Int32_val(vinit);
91c6a95
-    int32 * p;
91c6a95
+    int32_t init = Int32_val(vinit);
91c6a95
+    int32_t * p;
91c6a95
     for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
91c6a95
     break;
91c6a95
   }
91c6a95
   case CAML_BA_INT64: {
91c6a95
-    int64 init = Int64_val(vinit);
91c6a95
-    int64 * p;
91c6a95
+    int64_t init = Int64_val(vinit);
91c6a95
+    int64_t * p;
91c6a95
     for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
91c6a95
     break;
91c6a95
   }
91c6a95
diff --git a/otherlibs/num/nat_stubs.c b/otherlibs/num/nat_stubs.c
91c6a95
index 9a62759..d718a05 100644
91c6a95
--- a/otherlibs/num/nat_stubs.c
91c6a95
+++ b/otherlibs/num/nat_stubs.c
91c6a95
@@ -347,9 +347,9 @@ static void serialize_nat(value nat,
91c6a95
   if (len >= ((mlsize_t)1 << 32))
91c6a95
     failwith("output_value: nat too big");
91c6a95
 #endif
91c6a95
-  serialize_int_4((int32) len);
91c6a95
+  serialize_int_4((int32_t) len);
91c6a95
 #if defined(ARCH_SIXTYFOUR) && defined(ARCH_BIG_ENDIAN)
91c6a95
-  { int32 * p;
91c6a95
+  { int32_t * p;
91c6a95
     mlsize_t i;
91c6a95
     for (i = len, p = Data_custom_val(nat); i > 0; i -= 2, p += 2) {
91c6a95
       serialize_int_4(p[1]);    /* low 32 bits of 64-bit digit */
91c6a95
@@ -369,7 +369,7 @@ static uintnat deserialize_nat(void * dst)
91c6a95
 
91c6a95
   len = deserialize_uint_4();
91c6a95
 #if defined(ARCH_SIXTYFOUR) && defined(ARCH_BIG_ENDIAN)
91c6a95
-  { uint32 * p;
91c6a95
+  { uint32_t * p;
91c6a95
     mlsize_t i;
91c6a95
     for (i = len, p = dst; i > 1; i -= 2, p += 2) {
91c6a95
       p[1] = deserialize_uint_4();   /* low 32 bits of 64-bit digit */
91c6a95
@@ -385,7 +385,7 @@ static uintnat deserialize_nat(void * dst)
91c6a95
   deserialize_block_4(dst, len);
91c6a95
 #if defined(ARCH_SIXTYFOUR)
91c6a95
   if (len & 1){
91c6a95
-    ((uint32 *) dst)[len] = 0;
91c6a95
+    ((uint32_t *) dst)[len] = 0;
91c6a95
     ++ len;
91c6a95
   }
91c6a95
 #endif
91c6a95
@@ -396,7 +396,7 @@ static uintnat deserialize_nat(void * dst)
91c6a95
 static intnat hash_nat(value v)
91c6a95
 {
91c6a95
   bngsize len, i;
91c6a95
-  uint32 h;
91c6a95
+  uint32_t h;
91c6a95
 
91c6a95
   len = bng_num_digits(&Digit_val(v,0), Wosize_val(v) - 1);
91c6a95
   h = 0;
91c6a95
@@ -406,10 +406,10 @@ static intnat hash_nat(value v)
91c6a95
     /* Mix the two 32-bit halves as if we were on a 32-bit platform,
91c6a95
        namely low 32 bits first, then high 32 bits.
91c6a95
        Also, ignore final 32 bits if they are zero. */
91c6a95
-    h = caml_hash_mix_uint32(h, (uint32) d);
91c6a95
+    h = caml_hash_mix_uint32(h, (uint32_t) d);
91c6a95
     d = d >> 32;
91c6a95
     if (d == 0 && i + 1 == len) break;
91c6a95
-    h = caml_hash_mix_uint32(h, (uint32) d);
91c6a95
+    h = caml_hash_mix_uint32(h, (uint32_t) d);
91c6a95
 #else
91c6a95
     h = caml_hash_mix_uint32(h, d);
91c6a95
 #endif
91c6a95
diff --git a/otherlibs/unix/addrofstr.c b/otherlibs/unix/addrofstr.c
91c6a95
index e17841f..a2830ba 100644
91c6a95
--- a/otherlibs/unix/addrofstr.c
91c6a95
+++ b/otherlibs/unix/addrofstr.c
91c6a95
@@ -73,7 +73,7 @@ CAMLprim value unix_inet_addr_of_string(value s)
91c6a95
 #else
91c6a95
   struct in_addr address;
91c6a95
   address.s_addr = inet_addr(String_val(s));
91c6a95
-  if (address.s_addr == (uint32) -1) failwith("inet_addr_of_string");
91c6a95
+  if (address.s_addr == (uint32_t) -1) failwith("inet_addr_of_string");
91c6a95
   return alloc_inet_addr(&address);
91c6a95
 #endif
91c6a95
 }
91c6a95
diff --git a/stdlib/header.c b/stdlib/header.c
91c6a95
index cb3d995..93cdfeb 100644
91c6a95
--- a/stdlib/header.c
91c6a95
+++ b/stdlib/header.c
91c6a95
@@ -133,7 +133,7 @@ static char * read_runtime_path(int fd)
91c6a95
   char buffer[TRAILER_SIZE];
91c6a95
   static char runtime_path[MAXPATHLEN];
91c6a95
   int num_sections, i;
91c6a95
-  uint32 path_size;
91c6a95
+  uint32_t path_size;
91c6a95
   long ofs;
91c6a95
 
91c6a95
   lseek(fd, (long) -TRAILER_SIZE, SEEK_END);
91c6a95
-- 
91c6a95
2.0.4
91c6a95