Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
abseil-cpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Archive
Third Party Libraries
abseil-cpp
Commits
01174578
Unverified
Commit
01174578
authored
6 years ago
by
Matt Calabrese
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #201 from ccawley2011/fix-byteswap
Fix compilation of generic byteswap routines
parents
f86f9413
297e77fb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
absl/base/internal/endian.h
+14
-11
14 additions, 11 deletions
absl/base/internal/endian.h
with
14 additions
and
11 deletions
absl/base/internal/endian.h
+
14
−
11
View file @
01174578
...
...
@@ -82,14 +82,14 @@ inline uint64_t gbswap_64(uint64_t host_int) {
#elif defined(__GLIBC__)
return
bswap_64
(
host_int
);
#else
return
(((
x
&
uint64_t
{
(
0xFF
})
<<
56
)
|
((
x
&
uint64_t
{
(
0xFF00
})
<<
40
)
|
((
x
&
uint64_t
{
(
0xFF0000
})
<<
24
)
|
((
x
&
uint64_t
{
(
0xFF000000
})
<<
8
)
|
((
x
&
uint64_t
{
(
0xFF00000000
})
>>
8
)
|
((
x
&
uint64_t
{
(
0xFF0000000000
})
>>
24
)
|
((
x
&
uint64_t
{
(
0xFF000000000000
})
>>
40
)
|
((
x
&
uint64_t
{
(
0xFF00000000000000
})
>>
56
));
return
(((
host_int
&
uint64_t
{
0xFF
})
<<
56
)
|
((
host_int
&
uint64_t
{
0xFF00
})
<<
40
)
|
((
host_int
&
uint64_t
{
0xFF0000
})
<<
24
)
|
((
host_int
&
uint64_t
{
0xFF000000
})
<<
8
)
|
((
host_int
&
uint64_t
{
0xFF00000000
})
>>
8
)
|
((
host_int
&
uint64_t
{
0xFF0000000000
})
>>
24
)
|
((
host_int
&
uint64_t
{
0xFF000000000000
})
>>
40
)
|
((
host_int
&
uint64_t
{
0xFF00000000000000
})
>>
56
));
#endif // bswap_64
}
...
...
@@ -97,8 +97,10 @@ inline uint32_t gbswap_32(uint32_t host_int) {
#if defined(__GLIBC__)
return
bswap_32
(
host_int
);
#else
return
(((
x
&
0xFF
)
<<
24
)
|
((
x
&
0xFF00
)
<<
8
)
|
((
x
&
0xFF0000
)
>>
8
)
|
((
x
&
0xFF000000
)
>>
24
));
return
(((
host_int
&
uint32_t
{
0xFF
})
<<
24
)
|
((
host_int
&
uint32_t
{
0xFF00
})
<<
8
)
|
((
host_int
&
uint32_t
{
0xFF0000
})
>>
8
)
|
((
host_int
&
uint32_t
{
0xFF000000
})
>>
24
));
#endif
}
...
...
@@ -106,7 +108,8 @@ inline uint16_t gbswap_16(uint16_t host_int) {
#if defined(__GLIBC__)
return
bswap_16
(
host_int
);
#else
return
uint16_t
{((
x
&
0xFF
)
<<
8
)
|
((
x
&
0xFF00
)
>>
8
)};
return
(((
host_int
&
uint16_t
{
0xFF
})
<<
8
)
|
((
host_int
&
uint16_t
{
0xFF00
})
>>
8
));
#endif
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment