    inline cimg_uint64 nearest_pow2(const T& x) {
      cimg_uint64 i = 1;
      while (x>i) i<<=1;
      return i;
    }
    inline cimg_uint64 nearest_pow2(const T& x) {
      cimg_uint64 i = 1;
      while (x>i) i<<=1;
      return i;
    }