I've implemented, tested and merged several functions on system::chain::block to use in node and database. The core algorithm is this:
static constexpr bool is_malleable32(size_t set, size_t width) NOEXCEPT
{
for (auto depth = one; depth <= width; depth *= two, set = to_half(set))
if (is_odd(set)) return depth == width && !is_one(set);
return false;
} (edited)