Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Havar
asn1c
Commits
d7ad561a
Commit
d7ad561a
authored
Oct 26, 2004
by
Lev Walkin
Browse files
endianness
parent
6c452316
Changes
1
Hide whitespace changes
Inline
Side-by-side
skeletons/INTEGER.c
View file @
d7ad561a
...
...
@@ -352,6 +352,8 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
uint8_t
*
p
;
uint8_t
*
pstart
;
uint8_t
*
pend1
;
int
littleEndian
=
1
;
/* Run-time detection */
int
add
;
if
(
!
st
)
{
errno
=
EINVAL
;
...
...
@@ -361,15 +363,23 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
buf
=
(
uint8_t
*
)
MALLOC
(
sizeof
(
value
));
if
(
!
buf
)
return
-
1
;
pstart
=
(
uint8_t
*
)
&
value
;
pend1
=
pstart
+
sizeof
(
value
)
-
1
;
if
(
*
(
char
*
)
&
littleEndian
)
{
pstart
=
(
uint8_t
*
)
&
value
+
sizeof
(
value
)
-
1
;
pend1
=
(
uint8_t
*
)
&
value
;
add
=
-
1
;
}
else
{
pstart
=
(
uint8_t
*
)
&
value
;
pend1
=
pstart
+
sizeof
(
value
)
-
1
;
add
=
1
;
}
/*
* If the contents octet consists of more than one octet,
* then bits of the first octet and bit 8 of the second octet:
* a) shall not all be ones; and
* b) shall not all be zero.
*/
for
(
p
=
pstart
;
p
<
pend1
;
p
++
)
{
for
(
p
=
pstart
;
p
<
pend1
;
p
+=
add
)
{
switch
(
*
p
)
{
case
0x00
:
if
((
p
[
1
]
&
0x80
)
==
0
)
continue
;
...
...
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