mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-08 08:20:33 +00:00
Avoid signed overflow
This commit is contained in:
parent
4e49330ad4
commit
47e41d5b28
@ -1544,49 +1544,46 @@ int ddmat(rtk_t *rtk, double *D)
|
|||||||
|
|
||||||
for (f = 0, k = na;f<nf;f++, k+=MAXSAT)
|
for (f = 0, k = na;f<nf;f++, k+=MAXSAT)
|
||||||
{
|
{
|
||||||
for (i = k;i<k+MAXSAT;i++)
|
if(i < k + MAXSAT)
|
||||||
{
|
{
|
||||||
#if 0
|
for (i = k;i<k+MAXSAT;i++)
|
||||||
if (rtk->x[i] == 0.0||!test_sys(rtk->ssat[i-k].sys,m)||
|
|
||||||
!rtk->ssat[i-k].vsat[f])
|
|
||||||
{
|
{
|
||||||
#else
|
if (rtk->x[i] == 0.0 || !test_sys(rtk->ssat[i-k].sys, m) ||
|
||||||
if (rtk->x[i] == 0.0 || !test_sys(rtk->ssat[i-k].sys, m) ||
|
|
||||||
!rtk->ssat[i-k].vsat[f] || !rtk->ssat[i-k].half[f])
|
!rtk->ssat[i-k].vsat[f] || !rtk->ssat[i-k].half[f])
|
||||||
{
|
{
|
||||||
#endif
|
continue;
|
||||||
continue;
|
}
|
||||||
|
if (rtk->ssat[i-k].lock[f]>0 && !(rtk->ssat[i-k].slip[f]&2) &&
|
||||||
|
rtk->ssat[i-k].azel[1] >= rtk->opt.elmaskar && !nofix)
|
||||||
|
{
|
||||||
|
rtk->ssat[i-k].fix[f] = 2; /* fix */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else rtk->ssat[i-k].fix[f] = 1;
|
||||||
}
|
}
|
||||||
if (rtk->ssat[i-k].lock[f]>0 && !(rtk->ssat[i-k].slip[f]&2) &&
|
for (j = k;j<k+MAXSAT;j++)
|
||||||
rtk->ssat[i-k].azel[1] >= rtk->opt.elmaskar && !nofix)
|
|
||||||
{
|
{
|
||||||
rtk->ssat[i-k].fix[f] = 2; /* fix */
|
if (i == j || rtk->x[j] == 0.0 || !test_sys(rtk->ssat[j-k].sys, m) ||
|
||||||
break;
|
!rtk->ssat[j-k].vsat[f])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (rtk->ssat[j-k].lock[f]>0 && !(rtk->ssat[j-k].slip[f]&2) &&
|
||||||
|
rtk->ssat[i-k].vsat[f] &&
|
||||||
|
rtk->ssat[j-k].azel[1] >= rtk->opt.elmaskar && !nofix)
|
||||||
|
{
|
||||||
|
D[i+(na+nb)*nx] = 1.0;
|
||||||
|
D[j+(na+nb)*nx] = -1.0;
|
||||||
|
nb++;
|
||||||
|
rtk->ssat[j-k].fix[f] = 2; /* fix */
|
||||||
|
}
|
||||||
|
else rtk->ssat[j-k].fix[f] = 1;
|
||||||
}
|
}
|
||||||
else rtk->ssat[i-k].fix[f] = 1;
|
|
||||||
}
|
|
||||||
for (j = k;j<k+MAXSAT;j++)
|
|
||||||
{
|
|
||||||
if (i == j || rtk->x[j] == 0.0 || !test_sys(rtk->ssat[j-k].sys, m) ||
|
|
||||||
!rtk->ssat[j-k].vsat[f])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rtk->ssat[j-k].lock[f]>0 && !(rtk->ssat[j-k].slip[f]&2) &&
|
|
||||||
rtk->ssat[i-k].vsat[f] &&
|
|
||||||
rtk->ssat[j-k].azel[1] >= rtk->opt.elmaskar && !nofix)
|
|
||||||
{
|
|
||||||
D[i+(na+nb)*nx] = 1.0;
|
|
||||||
D[j+(na+nb)*nx] = -1.0;
|
|
||||||
nb++;
|
|
||||||
rtk->ssat[j-k].fix[f] = 2; /* fix */
|
|
||||||
}
|
|
||||||
else rtk->ssat[j-k].fix[f] = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trace(5, "D=\n"); tracemat(5, D, nx, na+nb, 2, 0);
|
trace(5, "D=\n"); tracemat(5, D, nx, na+nb, 2, 0);
|
||||||
return nb;
|
return nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user