constexpr version of nlz and some improvements to canonical(path)