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
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
spbro
OpenXG-RAN
Commits
d3048654
Commit
d3048654
authored
Aug 09, 2024
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for log2_approx to approximate to the nearest neighbor, instead of ceil
parent
385999dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
33 deletions
+23
-33
openair1/PHY/TOOLS/log2_approx.c
openair1/PHY/TOOLS/log2_approx.c
+23
-33
No files found.
openair1/PHY/TOOLS/log2_approx.c
View file @
d3048654
...
...
@@ -21,56 +21,46 @@
unsigned
char
log2_approx
(
unsigned
int
x
)
{
unsigned
char
l2
=
0
;
unsigned
int
tmp
=
x
>>
1
;
int
i
;
unsigned
char
l2
;
l2
=
0
;
for
(
i
=
0
;
i
<
31
;
i
++
)
if
((
x
&
(
1
<<
i
))
!=
0
)
l2
=
i
+
1
;
while
(
tmp
)
{
l2
++
;
tmp
>>=
1
;
}
//l2 = i;
if
(
l2
)
l2
+=
(
x
>>
(
l2
-
1
))
&
1
;
// printf("log2_approx = %d\n",l2);
return
(
l2
);
return
l2
;
}
unsigned
char
factor2
(
unsigned
int
x
)
{
unsigned
char
l2
=
0
;
int
i
;
unsigned
char
l2
;
l2
=
0
;
for
(
i
=
0
;
i
<
31
;
i
++
)
if
((
x
&
(
1
<<
i
))
!=
0
)
for
(
i
=
0
;
i
<
31
;
i
++
)
if
((
x
&
(
1
<<
i
))
!=
0
)
break
;
l2
=
i
;
//printf("factor2(%d) = %d\n",x,l2);
return
(
l2
);
return
l2
;
}
unsigned
char
log2_approx64
(
unsigned
long
long
int
x
)
{
unsigned
char
l2
=
0
;
unsigned
long
long
int
tmp
=
x
>>
1
;
int
i
;
unsigned
char
l2
;
l2
=
0
;
while
(
tmp
)
{
l2
++
;
tmp
>>=
1
;
}
for
(
i
=
0
;
i
<
63
;
i
++
)
if
((
x
&
(((
long
long
int
)
1
)
<<
i
))
!=
0
)
// l2 = i+1;
l2
=
i
;
if
(
l2
)
l2
+=
(
x
>>
(
l2
-
1
))
&
1
;
// printf("log2_approx = %d\n",l2);
return
(
l2
);
return
l2
;
}
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