jesd204sync: fix max_phase_deviation

This commit is contained in:
Sebastien Bourdeauducq 2019-01-28 18:38:18 +08:00
parent b9e3fab49c
commit eebff6d77f

View File

@ -164,7 +164,7 @@ fn measure_sysref_sh_limits() -> Result<SysrefShLimits, &'static str> {
fn max_phase_deviation(average: i32, phases: &[i32]) -> i32 {
let mut ret = 0;
for phase in phases.iter() {
let deviation = (phase - average).abs();
let deviation = (phase - average + DDMTD_N) % DDMTD_N;
if deviation > ret {
ret = deviation;
}