1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Avoid signed overflow

This commit is contained in:
Carles Fernandez 2017-08-26 10:07:18 +02:00 committed by Damian Miralles
parent e60a59160b
commit 7ae4a794f6

View File

@ -1544,49 +1544,46 @@ int ddmat(rtk_t *rtk, double *D)
for (f = 0, k = na;f<nf;f++, k+=MAXSAT)
{
for (i = k;i<k+MAXSAT;i++)
if(i < k + MAXSAT)
{
#if 0
if (rtk->x[i] == 0.0||!test_sys(rtk->ssat[i-k].sys,m)||
!rtk->ssat[i-k].vsat[f])
for (i = k;i<k+MAXSAT;i++)
{
#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])
{
#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) &&
rtk->ssat[i-k].azel[1] >= rtk->opt.elmaskar && !nofix)
for (j = k;j<k+MAXSAT;j++)
{
rtk->ssat[i-k].fix[f] = 2; /* fix */
break;
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;
}
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);
return nb;
trace(5, "D=\n"); tracemat(5, D, nx, na+nb, 2, 0);
return nb;
}