Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
4b679c07
Commit
4b679c07
authored
8 months ago
by
Thomas Schlichter
Committed by
francescomani
6 months ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for log2_approx64()
parent
58a29664
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
openair1/PHY/TOOLS/tests/test_log2_approx.cpp
openair1/PHY/TOOLS/tests/test_log2_approx.cpp
+17
-1
No files found.
openair1/PHY/TOOLS/tests/test_log2_approx.cpp
View file @
4b679c07
...
...
@@ -10,12 +10,28 @@ uint8_t log2_approx_ref(uint32_t x)
return
std
::
round
(
std
::
log2
(
x
));
}
TEST
(
log2_approx_ref
,
complete
)
uint8_t
log2_approx64_ref
(
unsigned
long
long
int
x
)
{
return
std
::
round
(
std
::
log2
(
static_cast
<
long
double
>
(
x
)));
}
TEST
(
log2_approx
,
complete
)
{
for
(
uint32_t
i
=
0
;
i
<
UINT32_MAX
;
i
++
)
EXPECT_EQ
(
log2_approx
(
i
),
log2_approx_ref
(
i
));
}
TEST
(
log2_approx64
,
boundaries
)
{
for
(
long
double
i
=
0
;
i
<
64
;
i
++
)
{
unsigned
long
long
i2
=
std
::
pow
(
2.0
L
,
i
+
0.5
L
);
for
(
unsigned
long
long
j
=
-
10
;
j
<=
10
;
j
++
)
{
unsigned
long
long
x
=
i2
+
j
;
EXPECT_EQ
(
log2_approx64
(
x
),
log2_approx64_ref
(
x
));
}
}
}
int
main
(
int
argc
,
char
**
argv
)
{
logInit
();
...
...
This diff is collapsed.
Click to expand it.
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