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
e5050988
Commit
e5050988
authored
Aug 16, 2016
by
Sergio Campama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding casts so that code importing protobug using -Wconversion does not generate warnings.
parent
e3891655
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
GPBUtilities_PackagePrivate.h
objectivec/GPBUtilities_PackagePrivate.h
+4
-4
No files found.
objectivec/GPBUtilities_PackagePrivate.h
View file @
e5050988
...
...
@@ -96,7 +96,7 @@ GPB_INLINE int64_t GPBLogicalRightShift64(int64_t value, int32_t spaces) {
// negative values must be sign-extended to 64 bits to be varint encoded,
// thus always taking 10 bytes on the wire.)
GPB_INLINE
int32_t
GPBDecodeZigZag32
(
uint32_t
n
)
{
return
GPBLogicalRightShift32
(
n
,
1
)
^
-
(
n
&
1
);
return
(
int32_t
)(
GPBLogicalRightShift32
((
int32_t
)
n
,
1
)
^
-
((
int32_t
)(
n
)
&
1
)
);
}
// Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
...
...
@@ -104,7 +104,7 @@ GPB_INLINE int32_t GPBDecodeZigZag32(uint32_t n) {
// negative values must be sign-extended to 64 bits to be varint encoded,
// thus always taking 10 bytes on the wire.)
GPB_INLINE
int64_t
GPBDecodeZigZag64
(
uint64_t
n
)
{
return
GPBLogicalRightShift64
(
n
,
1
)
^
-
(
n
&
1
);
return
(
int64_t
)(
GPBLogicalRightShift64
((
int64_t
)
n
,
1
)
^
-
((
int64_t
)(
n
)
&
1
)
);
}
// Encode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers
...
...
@@ -113,7 +113,7 @@ GPB_INLINE int64_t GPBDecodeZigZag64(uint64_t n) {
// thus always taking 10 bytes on the wire.)
GPB_INLINE
uint32_t
GPBEncodeZigZag32
(
int32_t
n
)
{
// Note: the right-shift must be arithmetic
return
(
n
<<
1
)
^
(
n
>>
31
);
return
(
uint32_t
)((
n
<<
1
)
^
(
n
>>
31
)
);
}
// Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
...
...
@@ -122,7 +122,7 @@ GPB_INLINE uint32_t GPBEncodeZigZag32(int32_t n) {
// thus always taking 10 bytes on the wire.)
GPB_INLINE
uint64_t
GPBEncodeZigZag64
(
int64_t
n
)
{
// Note: the right-shift must be arithmetic
return
(
n
<<
1
)
^
(
n
>>
63
);
return
(
uint64_t
)((
n
<<
1
)
^
(
n
>>
63
)
);
}
#pragma clang diagnostic push
...
...
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