comparison mercurial/mpatch.c @ 16385:e501f45b0eba

util.h: unify some common platform tweaks
author Matt Mackall <mpm@selenic.com>
date Tue, 10 Apr 2012 12:07:14 -0500
parents 8d821a173e4e
children d126a0d16856
comparison
equal deleted inserted replaced
16384:8d821a173e4e 16385:e501f45b0eba
23 #include <Python.h> 23 #include <Python.h>
24 #include <stdlib.h> 24 #include <stdlib.h>
25 #include <string.h> 25 #include <string.h>
26 26
27 #include "util.h" 27 #include "util.h"
28
29 #ifdef _WIN32
30 #ifdef _MSC_VER
31 /* msvc 6.0 has problems */
32 #define inline __inline
33 typedef unsigned long uint32_t;
34 #else
35 #include <stdint.h>
36 #endif
37 static uint32_t ntohl(uint32_t x)
38 {
39 return ((x & 0x000000ffUL) << 24) |
40 ((x & 0x0000ff00UL) << 8) |
41 ((x & 0x00ff0000UL) >> 8) |
42 ((x & 0xff000000UL) >> 24);
43 }
44 #else
45 /* not windows */
46 #include <sys/types.h>
47 #if defined __BEOS__ && !defined __HAIKU__
48 #include <ByteOrder.h>
49 #else
50 #include <arpa/inet.h>
51 #endif
52 #include <inttypes.h>
53 #endif
54 28
55 static char mpatch_doc[] = "Efficient binary patching."; 29 static char mpatch_doc[] = "Efficient binary patching.";
56 static PyObject *mpatch_Error; 30 static PyObject *mpatch_Error;
57 31
58 struct frag { 32 struct frag {