Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
29b5155a
Commit
29b5155a
authored
Aug 05, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
softpll_ng: fix division, using __div64_32
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
5a09064d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
softpll_ng.c
softpll/softpll_ng.c
+9
-2
No files found.
softpll/softpll_ng.c
View file @
29b5155a
...
...
@@ -670,14 +670,21 @@ static int calc_apr(int meas_min, int meas_max, int f_center )
int64_t
delta_low
=
meas_min
-
f_center
;
int64_t
delta_hi
=
meas_max
-
f_center
;
int
ppm_lo
,
ppm_hi
;
if
(
delta_low
>=
0
)
return
-
1
;
if
(
delta_hi
<=
0
)
return
-
1
;
int
ppm_lo
=
-
(
int64_t
)
delta_low
*
1000000LL
/
f_center
;
int
ppm_hi
=
(
int64_t
)
delta_hi
*
1000000LL
/
f_center
;
/* __div64_32 divides 64 by 32; result is in the 64 argument. */
delta_low
=
-
(
int64_t
)
delta_low
*
1000000LL
;
__div64_32
(
&
delta_low
,
f_center
);
ppm_lo
=
delta_low
;
delta_hi
=
delta_hi
*
1000000LL
;
__div64_32
(
&
delta_hi
,
f_center
);
ppm_hi
=
delta_hi
;
return
ppm_lo
<
ppm_hi
?
ppm_lo
:
ppm_hi
;
}
...
...
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