comparison mercurial/mpatch.c @ 2468:1ac0574f1768

mac os x: fixes for 10.2 from chris monson <monpublic@gmail.com>
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 20 Jun 2006 17:51:39 -0700
parents 345107e167a0
children 860e9c83fc59
comparison
equal deleted inserted replaced
2467:4e78dc71d946 2468:1ac0574f1768
21 */ 21 */
22 22
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 #ifdef _WIN32 27 #ifdef _WIN32
27 #ifdef _MSC_VER 28 # ifdef _MSC_VER
28 #define inline __inline 29 /* msvc 6.0 has problems */
30 # define inline __inline
29 typedef unsigned long uint32_t; 31 typedef unsigned long uint32_t;
30 #else 32 # else
31 #include <stdint.h> 33 # include <stdint.h>
32 #endif 34 # endif
33 static uint32_t ntohl(uint32_t x) 35 static uint32_t ntohl(uint32_t x)
34 { 36 {
35 return ((x & 0x000000ffUL) << 24) | 37 return ((x & 0x000000ffUL) << 24) |
36 ((x & 0x0000ff00UL) << 8) | 38 ((x & 0x0000ff00UL) << 8) |
37 ((x & 0x00ff0000UL) >> 8) | 39 ((x & 0x00ff0000UL) >> 8) |
38 ((x & 0xff000000UL) >> 24); 40 ((x & 0xff000000UL) >> 24);
39 } 41 }
40 #else 42 #else
41 #include <sys/types.h> 43 /* not windows */
42 #include <arpa/inet.h> 44 # include <sys/types.h>
45 # include <arpa/inet.h>
46 # include <stdint.h>
43 #endif 47 #endif
44 48
45 static char mpatch_doc[] = "Efficient binary patching."; 49 static char mpatch_doc[] = "Efficient binary patching.";
46 static PyObject *mpatch_Error; 50 static PyObject *mpatch_Error;
47 51