diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index 81aae28..3f2e0f1 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -451,8 +451,26 @@ namespace CNORXZ template bool GMIndex::formatIsTrivial() const { - CXZ_ERROR("IMPLEMENT!!!"); - return true; + if constexpr(std::is_same::value){ + return true; + } + else { + const bool ret1 = iter<0,NI> + ( [&](auto i) { return mIPack[i]->formatIsTrivial(); }, + [](const auto&... x) { return (x and ...); } ); + if(not ret1){ + return false; + } + const bool ret2 = iter<0,NI-1> + ( [&](auto j) { return mFormat[CSizeT{}].val() == mIPack[CSizeT{}].lmax().val() * mFormat[CSizeT{}].val(); }, + [](const auto&... x) { return (x and ...); }); + if(ret2 and mFormat[CSizeT{}].val() == 1){ + return true; + } + else { + return false; + } + } } template diff --git a/src/lib/ranges/yrange.cc b/src/lib/ranges/yrange.cc index 5f816f3..7569eb4 100644 --- a/src/lib/ranges/yrange.cc +++ b/src/lib/ranges/yrange.cc @@ -403,7 +403,19 @@ namespace CNORXZ bool YIndex::formatIsTrivial() const { - CXZ_ERROR("IMPLEMENT!!!"); + for(SizeT i = 0; i != mIs.size(); ++i){ + if(not mIs[i]->formatIsTrivial()){ + return false; + } + } + SizeT b = 1; + for(SizeT i = mFormat.size(); i != 0; --i){ + const SizeT j = i-1; + if(mFormat[j].val() != b){ + return false; + } + b *= mIs[j]->pmax().val(); + } return true; }