Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmp_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
7f829514
Commit
7f829514
authored
2 years ago
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Function macro optimisation
parent
0e99cb37
No related branches found
No related tags found
1 merge request
!13
Function macro optimisation
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/cmp_support.h
+28
-2
28 additions, 2 deletions
include/cmp_support.h
lib/cmp_support.c
+0
-30
0 additions, 30 deletions
lib/cmp_support.c
with
28 additions
and
32 deletions
include/cmp_support.h
+
28
−
2
View file @
7f829514
...
...
@@ -244,6 +244,32 @@ struct fx_cob_par {
};
/**
* @brief method for lossy rounding
* @note This function is implemented as a macro for the sake of performance
*
* @param value the value to round
* @param round rounding parameter
*
* @return rounded value
*/
#define round_fwd(value, round) ((uint32_t)(value) << (round))
/**
* @brief inverse method for lossy rounding
* @note This function is implemented as a macro for the sake of performance
*
* @param value the value to round back
* @param round rounding parameter
*
* @return back rounded value
*/
#define round_inv(value, round) ((uint32_t)(value) << (round))
int
is_a_pow_of_2
(
unsigned
int
v
);
int
ilog_2
(
uint32_t
x
);
...
...
@@ -273,8 +299,8 @@ int rdcu_supported_cmp_mode_is_used(enum cmp_mode cmp_mode);
int
zero_escape_mech_is_used
(
enum
cmp_mode
cmp_mode
);
int
multi_escape_mech_is_used
(
enum
cmp_mode
cmp_mode
);
uint32_
t
round_fwd
(
u
int32_
t
value
,
unsigned
int
round
);
uint32_
t
round_inv
(
u
int32_
t
value
,
unsigned
int
round
);
/* unsigned in
t round_fwd(u
nsigned in
t value, unsigned int round);
*/
/* unsigned in
t round_inv(u
nsigned in
t value, unsigned int round);
*/
unsigned
int
cmp_up_model
(
unsigned
int
data
,
unsigned
int
model
,
unsigned
int
model_value
,
unsigned
int
round
);
...
...
This diff is collapsed.
Click to expand it.
lib/cmp_support.c
+
0
−
30
View file @
7f829514
...
...
@@ -312,36 +312,6 @@ int cmp_aux_data_type_is_used(enum cmp_data_type data_type)
}
/**
* @brief method for lossy rounding
*
* @param value the value to round
* @param round rounding parameter
*
* @return rounded value
*/
inline
__attribute__
((
always_inline
))
uint32_t
round_fwd
(
uint32_t
value
,
unsigned
int
round
)
{
return
value
>>
round
;
}
/**
* @brief inverse method for lossy rounding
*
* @param value the value to round back
* @param round rounding parameter
*
* @return back rounded value
*/
inline
__attribute__
((
always_inline
))
uint32_t
round_inv
(
uint32_t
value
,
unsigned
int
round
)
{
return
value
<<
round
;
}
/**
* @brief implantation of the model update equation
* @note check before that model_value is not greater than MAX_MODEL_VALUE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment