Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
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
asn1c
Commits
3fd85d8a
Commit
3fd85d8a
authored
Jul 24, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PER aligned flush
parent
f573ebbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
skeletons/per_support.c
skeletons/per_support.c
+24
-1
skeletons/per_support.h
skeletons/per_support.h
+7
-0
No files found.
skeletons/per_support.c
View file @
3fd85d8a
...
...
@@ -316,6 +316,27 @@ int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int
}
}
int
per_put_aligned_flush
(
asn_per_outp_t
*
po
)
{
uint32_t
unused_bits
=
(
0x7
&
(
8
-
(
po
->
nboff
&
0x07
)));
size_t
complete_bytes
=
(
po
->
buffer
?
po
->
buffer
-
po
->
tmpspace
:
0
)
+
((
po
->
nboff
+
7
)
>>
3
);
if
(
unused_bits
)
{
po
->
buffer
[
po
->
nboff
>>
3
]
&=
~
0
<<
unused_bits
;
}
if
(
po
->
outper
(
po
->
tmpspace
,
complete_bytes
,
po
->
op_key
)
<
0
)
{
return
-
1
;
}
else
{
po
->
buffer
=
po
->
tmpspace
;
po
->
nboff
=
0
;
po
->
nbits
=
8
*
sizeof
(
po
->
tmpspace
);
po
->
flushed_bytes
+=
complete_bytes
;
return
0
;
}
}
/*
* Put a small number of bits (<= 31).
*/
...
...
@@ -343,7 +364,9 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
* Flush whole-bytes output, if necessary.
*/
if
(
po
->
nboff
+
obits
>
po
->
nbits
)
{
int
complete_bytes
=
(
po
->
buffer
-
po
->
tmpspace
);
size_t
complete_bytes
;
if
(
!
po
->
buffer
)
po
->
buffer
=
po
->
tmpspace
;
complete_bytes
=
(
po
->
buffer
-
po
->
tmpspace
);
ASN_DEBUG
(
"[PER output %ld complete + %ld]"
,
(
long
)
complete_bytes
,
(
long
)
po
->
flushed_bytes
);
if
(
po
->
outper
(
po
->
tmpspace
,
complete_bytes
,
po
->
op_key
)
<
0
)
...
...
skeletons/per_support.h
View file @
3fd85d8a
...
...
@@ -106,6 +106,13 @@ int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits);
/* Output a large number of bits */
int
per_put_many_bits
(
asn_per_outp_t
*
po
,
const
uint8_t
*
src
,
int
put_nbits
);
/*
* Flush whole bytes (0 or more) through (outper) member.
* The least significant bits which are not used are guaranteed to be set to 0.
* Returns -1 if callback returns -1. Otherwise, 0.
*/
int
per_put_aligned_flush
(
asn_per_outp_t
*
po
);
/* X.691-2008/11, #11.5 */
int
uper_put_constrained_whole_number_s
(
asn_per_outp_t
*
po
,
long
v
,
int
nbits
);
int
uper_put_constrained_whole_number_u
(
asn_per_outp_t
*
po
,
unsigned
long
v
,
int
nbits
);
...
...
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