Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2590093c authored by hhakim's avatar hhakim
Browse files

Fix return ref to local variable in MatButterfly/MatPerm.

In tests faust_butterfly_mat.cpp.in/faust_perm_mat.cpp.in
parent 7c5750ab
Branches
Tags
No related merge requests found
......@@ -51,6 +51,7 @@ namespace Faust
#endif
int level;
bool is_transp;
FPP zero;
public:
......
......@@ -7,7 +7,7 @@ namespace Faust
//TODO: dtor?
template<typename FPP>
MatButterfly<FPP, Cpu>::MatButterfly(const MatSparse<FPP, Cpu> &factor, int level)
MatButterfly<FPP, Cpu>::MatButterfly(const MatSparse<FPP, Cpu> &factor, int level) : zero(FPP(0))
{
// build a d1, d2 pair from the butterfly factor
auto size = factor.getNbRow();
......@@ -71,6 +71,7 @@ namespace Faust
#endif
level = src.level;
is_transp = src.is_transp;
this->zero = src.zero;
return *this;
}
......@@ -471,11 +472,11 @@ namespace Faust
if(j == i - k)
return d2_ptr[i];
else
return FPP(0);
zero;
if(j == i + k)
return d2_ptr[i];
else
return FPP(0);
return zero;
}
......
......@@ -45,6 +45,7 @@ namespace Faust
long *perm_ids_ptr;
#endif
bool is_transp;
FPP zero;
public:
......
......@@ -5,7 +5,7 @@ namespace Faust
//TODO: dtor?
//
template<typename FPP>
MatPerm<FPP, Cpu>::MatPerm()
MatPerm<FPP, Cpu>::MatPerm() : zero(FPP(0))
{
#ifdef USE_PYTHONIC
perm_ids_ptr = nullptr;
......@@ -441,7 +441,7 @@ namespace Faust
if(j == perm_ids[i])
return d_ptr[i];
else
return FPP(0);
return zero;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment