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
6ea088f4
Commit
6ea088f4
authored
Sep 07, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speed-up in one special case
parent
07b5192c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
libasn1compiler/asn1c_constraint.c
libasn1compiler/asn1c_constraint.c
+20
-3
No files found.
libasn1compiler/asn1c_constraint.c
View file @
6ea088f4
...
...
@@ -8,7 +8,7 @@
static
int
asn1c_emit_constraint_tables
(
arg_t
*
arg
,
int
got_size
);
static
int
emit_alphabet_check_loop
(
arg_t
*
arg
,
asn1cnst_range_t
*
range
);
static
int
emit_value_determination_code
(
arg_t
*
arg
,
asn1p_expr_type_e
etype
);
static
int
emit_value_determination_code
(
arg_t
*
arg
,
asn1p_expr_type_e
etype
,
asn1cnst_range_t
*
r_value
);
static
int
emit_size_determination_code
(
arg_t
*
arg
,
asn1p_expr_type_e
etype
);
static
asn1p_expr_type_e
_find_terminal_type
(
arg_t
*
arg
);
static
int
emit_range_comparison_code
(
arg_t
*
arg
,
asn1cnst_range_t
*
range
,
const
char
*
varname
,
asn1_integer_t
natural_start
,
asn1_integer_t
natural_stop
);
...
...
@@ -115,7 +115,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
OUT
(
"
\n
"
);
if
(
r_value
)
emit_value_determination_code
(
arg
,
etype
);
emit_value_determination_code
(
arg
,
etype
,
r_value
);
if
(
r_size
)
emit_size_determination_code
(
arg
,
etype
);
...
...
@@ -544,7 +544,7 @@ emit_size_determination_code(arg_t *arg, asn1p_expr_type_e etype) {
}
static
int
emit_value_determination_code
(
arg_t
*
arg
,
asn1p_expr_type_e
etype
)
{
emit_value_determination_code
(
arg_t
*
arg
,
asn1p_expr_type_e
etype
,
asn1cnst_range_t
*
r_value
)
{
switch
(
etype
)
{
case
ASN_BASIC_INTEGER
:
...
...
@@ -552,6 +552,23 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype) {
if
(
arg
->
flags
&
A1C_USE_NATIVE_INTEGERS
)
{
OUT
(
"value = *(const int *)sptr;
\n
"
);
}
else
{
if
(
r_value
->
el_count
==
0
&&
(
/* Speed-up common case: (0..MAX) */
(
r_value
->
left
.
type
==
ARE_VALUE
&&
r_value
->
left
.
value
==
0
&&
r_value
->
right
.
type
==
ARE_MAX
)
||
/* Speed-up common case: (MIN..-1) */
(
r_value
->
left
.
type
==
ARE_MIN
&&
r_value
->
right
.
type
==
ARE_VALUE
&&
r_value
->
right
.
value
==
-
1
)
))
{
OUT
(
"/* Check if the sign bit is present */
\n
"
);
OUT
(
"value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
\n
"
);
break
;
}
OUT
(
"if(asn1_INTEGER2long(st, &value)) {
\n
"
);
INDENT
(
+
1
);
OUT
(
"_ASN_ERRLOG(app_errlog, app_key,
\n
"
);
...
...
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