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
3a0be889
Unverified
Commit
3a0be889
authored
Sep 20, 2019
by
Paul Yang
Committed by
GitHub
Sep 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6681 from thomasvl/objc_fix2
Pull the ObjC fixes from #6679 to the 3.10.x branch
parents
33151f2c
397e017c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
GPBCodedInputStream.m
objectivec/GPBCodedInputStream.m
+10
-2
GPBUtilities_PackagePrivate.h
objectivec/GPBUtilities_PackagePrivate.h
+16
-12
No files found.
objectivec/GPBCodedInputStream.m
View file @
3a0be889
...
...
@@ -93,14 +93,22 @@ static int8_t ReadRawByte(GPBCodedInputStreamState *state) {
static
int32_t
ReadRawLittleEndian32
(
GPBCodedInputStreamState
*
state
)
{
CheckSize
(
state
,
sizeof
(
int32_t
));
int32_t
value
=
OSReadLittleInt32
(
state
->
bytes
,
state
->
bufferPos
);
// Not using OSReadLittleInt32 because it has undocumented dependency
// on reads being aligned.
int32_t
value
;
memcpy
(
&
value
,
state
->
bytes
+
state
->
bufferPos
,
sizeof
(
int32_t
));
value
=
OSSwapLittleToHostInt32
(
value
);
state
->
bufferPos
+=
sizeof
(
int32_t
);
return
value
;
}
static
int64_t
ReadRawLittleEndian64
(
GPBCodedInputStreamState
*
state
)
{
CheckSize
(
state
,
sizeof
(
int64_t
));
int64_t
value
=
OSReadLittleInt64
(
state
->
bytes
,
state
->
bufferPos
);
// Not using OSReadLittleInt64 because it has undocumented dependency
// on reads being aligned.
int64_t
value
;
memcpy
(
&
value
,
state
->
bytes
+
state
->
bufferPos
,
sizeof
(
int64_t
));
value
=
OSSwapLittleToHostInt64
(
value
);
state
->
bufferPos
+=
sizeof
(
int64_t
);
return
value
;
}
...
...
objectivec/GPBUtilities_PackagePrivate.h
View file @
3a0be889
...
...
@@ -71,27 +71,31 @@ GPB_INLINE void GPBDebugCheckRuntimeVersion() {
// Conversion functions for de/serializing floating point types.
GPB_INLINE
int64_t
GPBConvertDoubleToInt64
(
double
v
)
{
union
{
double
f
;
int64_t
i
;
}
u
;
u
.
f
=
v
;
return
u
.
i
;
GPBInternalCompileAssert
(
sizeof
(
double
)
==
sizeof
(
int64_t
),
double_not_64_bits
);
int64_t
result
;
memcpy
(
&
result
,
&
v
,
sizeof
(
result
));
return
result
;
}
GPB_INLINE
int32_t
GPBConvertFloatToInt32
(
float
v
)
{
union
{
float
f
;
int32_t
i
;
}
u
;
u
.
f
=
v
;
return
u
.
i
;
GPBInternalCompileAssert
(
sizeof
(
float
)
==
sizeof
(
int32_t
),
float_not_32_bits
);
int32_t
result
;
memcpy
(
&
result
,
&
v
,
sizeof
(
result
));
return
result
;
}
GPB_INLINE
double
GPBConvertInt64ToDouble
(
int64_t
v
)
{
union
{
double
f
;
int64_t
i
;
}
u
;
u
.
i
=
v
;
return
u
.
f
;
GPBInternalCompileAssert
(
sizeof
(
double
)
==
sizeof
(
int64_t
),
double_not_64_bits
);
double
result
;
memcpy
(
&
result
,
&
v
,
sizeof
(
result
));
return
result
;
}
GPB_INLINE
float
GPBConvertInt32ToFloat
(
int32_t
v
)
{
union
{
float
f
;
int32_t
i
;
}
u
;
u
.
i
=
v
;
return
u
.
f
;
GPBInternalCompileAssert
(
sizeof
(
float
)
==
sizeof
(
int32_t
),
float_not_32_bits
);
float
result
;
memcpy
(
&
result
,
&
v
,
sizeof
(
result
));
return
result
;
}
GPB_INLINE
int32_t
GPBLogicalRightShift32
(
int32_t
value
,
int32_t
spaces
)
{
...
...
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