// file : libbuild2/bin/utility.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file namespace build2 { namespace bin { inline ltype link_type (const target_type& tt) { bool u (false); otype o ( tt.is_a () || (u = tt.is_a ()) ? otype::e : tt.is_a () || (u = tt.is_a ()) ? otype::a : tt.is_a () || (u = tt.is_a ()) ? otype::s : static_cast (0xFF)); return ltype {o, u}; } inline pair link_member (lmembers lm, lorder lo) { bool r (true); bool s (true); switch (lo) { case lorder::a: case lorder::a_s: s = false; // Fall through. case lorder::s: case lorder::s_a: { if (s ? !lm.s : !lm.a) { if (lo == lorder::a_s || lo == lorder::s_a) s = !s; else r = false; // Not available. } } } return make_pair (s ? otype::s : otype::a, r); } } }