MCPcopy Create free account
hub / github.com/KLayout/klayout / factor

Method factor

src/laybasic/laybasic/layLayerProperties.cc:1022–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020}
1021
1022std::pair<size_t, size_t>
1023LayerPropertiesConstIterator::factor () const
1024{
1025 tl_assert (m_list);
1026
1027 // with this definition, the 0 iterator can act as the "root"
1028 if (m_uint == 0) {
1029 return std::make_pair (size_t (1), size_t (1));
1030 }
1031
1032 LayerPropertiesList::const_iterator iter = m_list->begin_const ();
1033 size_t uint = m_uint;
1034 size_t n = ((m_list->end_const () - m_list->begin_const ()) + 2);
1035 size_t f = 1;
1036
1037 while (uint > n) {
1038 size_t rem = uint % n;
1039 uint /= n;
1040 f *= n;
1041 tl_assert (rem < n - 1 && rem > 0);
1042 n = ((iter[rem - 1].end_children () - iter[rem - 1].begin_children ()) + 2);
1043 iter = iter[rem - 1].begin_children ();
1044 }
1045
1046 return std::make_pair (f, n);
1047}
1048
1049bool
1050LayerPropertiesConstIterator::at_end () const

Callers

nothing calls this directly

Calls 4

begin_constMethod · 0.80
end_constMethod · 0.80
end_childrenMethod · 0.45
begin_childrenMethod · 0.45

Tested by

no test coverage detected