Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
protobuf-c
Commits
49faa55b
Commit
49faa55b
authored
Nov 21, 2013
by
Robert Edmonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IS_LITTLE_ENDIAN -> !defined(WORDS_BIGENDIAN)
this simplifies the AC_C_BIGENDIAN invocation.
parent
97c43bab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
16 deletions
+12
-16
configure.ac
configure.ac
+1
-5
protobuf-c-rpc/protobuf-c-rpc.c
protobuf-c-rpc/protobuf-c-rpc.c
+1
-1
protobuf-c/protobuf-c.c
protobuf-c/protobuf-c.c
+10
-10
No files found.
configure.ac
View file @
49faa55b
...
...
@@ -46,11 +46,7 @@ AC_ARG_ENABLE(
)
AM_CONDITIONAL([BUILD_RPC], [test "x$enable_rpc" = "xyes"])
AC_C_BIGENDIAN(
[AC_DEFINE([IS_LITTLE_ENDIAN], [0], [Define to 1 if system is little endian])],
[AC_DEFINE([IS_LITTLE_ENDIAN], [1], [Define to 1 if system is little endian])],
[AC_MSG_FAILURE([unable to determine endianness])]
)
AC_C_BIGENDIAN
AC_OUTPUT
AC_MSG_RESULT([
...
...
protobuf-c-rpc/protobuf-c-rpc.c
View file @
49faa55b
...
...
@@ -444,7 +444,7 @@ grow_closure_array (ProtobufC_RPC_Client *client)
static
uint32_t
uint32_to_le
(
uint32_t
le
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
return
le
;
#else
return
(
le
<<
24
)
|
(
le
>>
24
)
...
...
protobuf-c/protobuf-c.c
View file @
49faa55b
...
...
@@ -619,7 +619,7 @@ sint64_pack (int64_t value, uint8_t *out)
static
inline
size_t
fixed32_pack
(
uint32_t
value
,
void
*
out
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
memcpy
(
out
,
&
value
,
4
);
#else
uint8_t
*
buf
=
out
;
...
...
@@ -639,7 +639,7 @@ fixed32_pack (uint32_t value, void *out)
static
inline
size_t
fixed64_pack
(
uint64_t
value
,
void
*
out
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
memcpy
(
out
,
&
value
,
8
);
#else
fixed32_pack
(
value
,
out
);
...
...
@@ -843,7 +843,7 @@ sizeof_elt_in_repeated_array (ProtobufCType type)
static
void
copy_to_little_endian_32
(
void
*
out
,
const
void
*
in
,
unsigned
N
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
memcpy
(
out
,
in
,
N
*
4
);
#else
unsigned
i
;
...
...
@@ -855,7 +855,7 @@ copy_to_little_endian_32 (void *out, const void *in, unsigned N)
static
void
copy_to_little_endian_64
(
void
*
out
,
const
void
*
in
,
unsigned
N
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
memcpy
(
out
,
in
,
N
*
8
);
#else
unsigned
i
;
...
...
@@ -1246,7 +1246,7 @@ pack_buffer_packed_payload (const ProtobufCFieldDescriptor *field,
case
PROTOBUF_C_TYPE_SFIXED32
:
case
PROTOBUF_C_TYPE_FIXED32
:
case
PROTOBUF_C_TYPE_FLOAT
:
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
rv
=
count
*
4
;
goto
no_packing_needed
;
#else
...
...
@@ -1261,7 +1261,7 @@ pack_buffer_packed_payload (const ProtobufCFieldDescriptor *field,
case
PROTOBUF_C_TYPE_SFIXED64
:
case
PROTOBUF_C_TYPE_FIXED64
:
case
PROTOBUF_C_TYPE_DOUBLE
:
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
rv
=
count
*
8
;
goto
no_packing_needed
;
#else
...
...
@@ -1635,7 +1635,7 @@ unzigzag32 (uint32_t v)
static
inline
uint32_t
parse_fixed_uint32
(
const
uint8_t
*
data
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
uint32_t
t
;
memcpy
(
&
t
,
data
,
4
);
return
t
;
...
...
@@ -1673,7 +1673,7 @@ unzigzag64 (uint64_t v)
static
inline
uint64_t
parse_fixed_uint64
(
const
uint8_t
*
data
)
{
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
uint64_t
t
;
memcpy
(
&
t
,
data
,
8
);
return
t
;
...
...
@@ -1878,7 +1878,7 @@ parse_packed_repeated_member (ScannedMember *scanned_member,
case
PROTOBUF_C_TYPE_FIXED32
:
case
PROTOBUF_C_TYPE_FLOAT
:
count
=
(
scanned_member
->
len
-
scanned_member
->
length_prefix_len
)
/
4
;
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
goto
no_unpacking_needed
;
#else
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
@@ -1892,7 +1892,7 @@ parse_packed_repeated_member (ScannedMember *scanned_member,
case
PROTOBUF_C_TYPE_FIXED64
:
case
PROTOBUF_C_TYPE_DOUBLE
:
count
=
(
scanned_member
->
len
-
scanned_member
->
length_prefix_len
)
/
8
;
#if
IS_LITTLE_ENDIAN
#if
!defined(WORDS_BIGENDIAN)
goto
no_unpacking_needed
;
#else
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
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