Skip to content

Add implementation of bit_width to big unsigned int

The functions std::bit_width and std::countl_zero were added to the C++20 standard for integral types so it make sense to support them in Dune::bigunsignedint too.

These functions are useful on bit-fields computations, in particular, we use std::countl_zero in dune-mutidomaingrid to properly select an minimal sized integer type of a bit-field containing a domain set (to which domains an entity belongs to). This is using compiler built-ins at the moment but now we can use the new standard functions, and furthermore, if these functions also exist in Dune::bigunsignedint we could allow arbitrary sized bit-fields.

Edited by Santiago Ospina De Los Ríos

Merge request reports

Loading