static void pidclean () { for (; !pidfiles.empty (); pidfiles.pop_front ()) { pidfile &pf = pidfiles.front (); struct stat sb; if (!stat (pf.path, &sb) && sb.st_dev == pf.sb.st_dev && sb.st_ino == pf.sb.st_ino) unlink (pf.path); } }
vvec perm(vec const &v){ vvec r; if (v.size() == 1) { r.push_back({v.front()}); return r; } for (int i = 0; i < v.size(); ++i){ vec vt = v; vt.erase(vt.begin() + i); vvec rT = perm(vt); for (auto x : rT){ x.push_back(v[i]); r.push_back(x); } } return r; }
KFR_INTRINSIC void write(cunaligned_t, T* ptr, const vec<T, 1>& x) { *ptr = x.front(); }
KFR_INTRINSIC T horizontal_impl(const vec<T, 1>& value, ReduceFn&&) { return T(value.front()); }