Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
59b360f6
Commit
59b360f6
authored
Aug 27, 2015
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #767 from pkasting/port
Avoid #including system headers from inside a namespace.
parents
c7a1f8ec
2e789bc2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
port.h
src/google/protobuf/stubs/port.h
+10
-6
No files found.
src/google/protobuf/stubs/port.h
View file @
59b360f6
...
...
@@ -79,6 +79,15 @@
#define LIBPROTOC_EXPORT
#endif
// These #includes are for the byte swap functions declared later on.
#ifdef _MSC_VER
#include <stdlib.h> // NOLINT(build/include)
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#elif defined(__GLIBC__) || defined(__CYGWIN__)
#include <byteswap.h> // IWYU pragma: export
#endif
// ===================================================================
// from google3/base/port.h
namespace
google
{
...
...
@@ -275,7 +284,6 @@ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) {
// The following guarantees declaration of the byte swap functions, and
// defines __BYTE_ORDER for MSVC
#ifdef _MSC_VER
#include <stdlib.h> // NOLINT(build/include)
#define __BYTE_ORDER __LITTLE_ENDIAN
#define bswap_16(x) _byteswap_ushort(x)
#define bswap_32(x) _byteswap_ulong(x)
...
...
@@ -283,15 +291,11 @@ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) {
#elif defined(__APPLE__)
// Mac OS X / Darwin features
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
#elif defined(__GLIBC__) || defined(__CYGWIN__)
#include <byteswap.h> // IWYU pragma: export
#else
#elif !defined(__GLIBC__) && !defined(__CYGWIN__)
static
inline
uint16
bswap_16
(
uint16
x
)
{
return
static_cast
<
uint16
>
(((
x
&
0xFF
)
<<
8
)
|
((
x
&
0xFF00
)
>>
8
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment