comparison mercurial/bdiff.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 8134ec8627e7
children d126a0d16856
comparison
equal deleted inserted replaced
16384:8d821a173e4e 16385:e501f45b0eba
11 11
12 #include <Python.h> 12 #include <Python.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <string.h> 14 #include <string.h>
15 #include <limits.h> 15 #include <limits.h>
16
17 #if defined __hpux || defined __SUNPRO_C || defined _AIX
18 #define inline
19 #endif
20
21 #ifdef __linux
22 #define inline __inline
23 #endif
24
25 #ifdef _WIN32
26 #ifdef _MSC_VER
27 #define inline __inline
28 typedef unsigned long uint32_t;
29 #else
30 #include <stdint.h>
31 #endif
32 static uint32_t htonl(uint32_t x)
33 {
34 return ((x & 0x000000ffUL) << 24) |
35 ((x & 0x0000ff00UL) << 8) |
36 ((x & 0x00ff0000UL) >> 8) |
37 ((x & 0xff000000UL) >> 24);
38 }
39 #else
40 #include <sys/types.h>
41 #if defined __BEOS__ && !defined __HAIKU__
42 #include <ByteOrder.h>
43 #else
44 #include <arpa/inet.h>
45 #endif
46 #include <inttypes.h>
47 #endif
48 16
49 #include "util.h" 17 #include "util.h"
50 18
51 struct line { 19 struct line {
52 int hash, len, n, e; 20 int hash, len, n, e;