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
fe773bfe
Unverified
Commit
fe773bfe
authored
Apr 27, 2018
by
Feng Xiao
Committed by
GitHub
Apr 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4572 from jozefizso/fix/4494_compilation_error_c4146
Using binary one's complement to negate an unsigned int
parents
2131584b
8a603ec4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
wire_format_lite.h
src/google/protobuf/wire_format_lite.h
+2
-2
No files found.
src/google/protobuf/wire_format_lite.h
View file @
fe773bfe
...
...
@@ -860,7 +860,7 @@ inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
inline
int32
WireFormatLite
::
ZigZagDecode32
(
uint32
n
)
{
// Note: Using unsigned types prevent undefined behavior
return
static_cast
<
int32
>
((
n
>>
1
)
^
-
(
n
&
1
));
return
static_cast
<
int32
>
((
n
>>
1
)
^
(
~
(
n
&
1
)
+
1
));
}
inline
uint64
WireFormatLite
::
ZigZagEncode64
(
int64
n
)
{
...
...
@@ -871,7 +871,7 @@ inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
inline
int64
WireFormatLite
::
ZigZagDecode64
(
uint64
n
)
{
// Note: Using unsigned types prevent undefined behavior
return
static_cast
<
int64
>
((
n
>>
1
)
^
-
(
n
&
1
));
return
static_cast
<
int64
>
((
n
>>
1
)
^
(
~
(
n
&
1
)
+
1
));
}
// String is for UTF-8 text only, but, even so, ReadString() can simply
...
...
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