Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
capnproto
Commits
e21b854d
Commit
e21b854d
authored
Aug 11, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__buistin_bswap16() is apparently missing on Cygwin32.
parent
c633a6f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
endian.h
c++/src/capnp/endian.h
+6
-2
No files found.
c++/src/capnp/endian.h
View file @
e21b854d
...
...
@@ -98,7 +98,9 @@ template <typename T>
class
SwappingWireValue
<
T
,
2
>
{
public
:
KJ_ALWAYS_INLINE
(
T
get
()
const
)
{
uint16_t
swapped
=
__builtin_bswap16
(
value
);
// Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing
// on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64).
uint16_t
swapped
=
(
value
<<
8
)
|
(
value
>>
8
);
T
result
;
memcpy
(
&
result
,
&
swapped
,
sizeof
(
T
));
return
result
;
...
...
@@ -106,7 +108,9 @@ public:
KJ_ALWAYS_INLINE
(
void
set
(
T
newValue
))
{
uint16_t
raw
;
memcpy
(
&
raw
,
&
newValue
,
sizeof
(
T
));
value
=
__builtin_bswap16
(
raw
);
// Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing
// on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64).
value
=
(
raw
<<
8
)
|
(
raw
>>
8
);
}
private
:
...
...
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