OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004--2005, Google Inc. | 3 * Copyright 2004--2005, Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 15 matching lines...) Expand all Loading... | |
26 */ | 26 */ |
27 | 27 |
28 #ifndef TALK_BASE_BYTEORDER_H__ | 28 #ifndef TALK_BASE_BYTEORDER_H__ |
29 #define TALK_BASE_BYTEORDER_H__ | 29 #define TALK_BASE_BYTEORDER_H__ |
30 | 30 |
31 #ifdef POSIX | 31 #ifdef POSIX |
32 #include <arpa/inet.h> | 32 #include <arpa/inet.h> |
33 #endif | 33 #endif |
34 | 34 |
35 #ifdef WIN32 | 35 #ifdef WIN32 |
36 #include <winsock2.h> | 36 #include <winsock2.h> |
tommi (sloooow) - chröme
2012/02/28 21:32:18
do we still need this header?
Ronghua Wu (Left Chromium)
2012/02/28 23:16:57
Some other files in libjingle that includes this f
| |
37 #include "talk/base/win32.h" | |
37 #endif | 38 #endif |
38 | 39 |
39 #include "talk/base/basictypes.h" | 40 #include "talk/base/basictypes.h" |
40 | 41 |
41 namespace talk_base { | 42 namespace talk_base { |
42 | 43 |
43 // Reading and writing of little and big-endian numbers from memory | 44 // Reading and writing of little and big-endian numbers from memory |
44 // TODO: Add HostEndian #defines (HE) | 45 // TODO: Add HostEndian #defines (HE) |
45 // TODO: Consider NetworkEndian as synonym for BigEndian, for clarity in use. | 46 // TODO: Consider NetworkEndian as synonym for BigEndian, for clarity in use. |
46 // TODO: Consider creating optimized versions, such as direct read/writes of | 47 // TODO: Consider creating optimized versions, such as direct read/writes of |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 } | 164 } |
164 | 165 |
165 inline uint64 NetworkToHost64(uint64 n) { | 166 inline uint64 NetworkToHost64(uint64 n) { |
166 // If the host is little endian, GetBE64 converts n to little endian. | 167 // If the host is little endian, GetBE64 converts n to little endian. |
167 return IsHostBigEndian() ? n : GetBE64(&n); | 168 return IsHostBigEndian() ? n : GetBE64(&n); |
168 } | 169 } |
169 | 170 |
170 } // namespace talk_base | 171 } // namespace talk_base |
171 | 172 |
172 #endif // TALK_BASE_BYTEORDER_H__ | 173 #endif // TALK_BASE_BYTEORDER_H__ |
OLD | NEW |