OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_BIG_ENDIAN_H_ | 5 #ifndef NET_BASE_BIG_ENDIAN_H_ |
6 #define NET_BASE_BIG_ENDIAN_H_ | 6 #define NET_BASE_BIG_ENDIAN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 // Read an integer (signed or unsigned) from |buf| in Big Endian order. | 14 // Read an integer (signed or unsigned) from |buf| in Big Endian order. |
15 // Note: this loop is unrolled with -O1 and above. | 15 // Note: this loop is unrolled with -O1 and above. |
16 // NOTE(szym): glibc dns-canon.c and SpdyFrameBuilder use | 16 // NOTE(szym): glibc dns-canon.c and SpdyFrameBuilder use |
17 // ntohs(*(uint16_t*)ptr) which is potentially unaligned. | 17 // ntohs(*(uint16_t*)ptr) which is potentially unaligned. |
18 // This would cause SIGBUS on ARMv5 or earlier and ARMv6-M. | 18 // This would cause SIGBUS on ARMv5 or earlier and ARMv6-M. |
19 template<typename T> | 19 template<typename T> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool Write(T v); | 94 bool Write(T v); |
95 | 95 |
96 char* ptr_; | 96 char* ptr_; |
97 char* end_; | 97 char* end_; |
98 }; | 98 }; |
99 | 99 |
100 } // namespace net | 100 } // namespace net |
101 | 101 |
102 #endif // NET_BASE_BIG_ENDIAN_H_ | 102 #endif // NET_BASE_BIG_ENDIAN_H_ |
103 | 103 |
OLD | NEW |