diff options
Diffstat (limited to 'doc/src/snippets/code/src_xmlpatterns_api_qxmlname.cpp')
-rw-r--r-- | doc/src/snippets/code/src_xmlpatterns_api_qxmlname.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_xmlpatterns_api_qxmlname.cpp b/doc/src/snippets/code/src_xmlpatterns_api_qxmlname.cpp new file mode 100644 index 0000000..2c891b5 --- /dev/null +++ b/doc/src/snippets/code/src_xmlpatterns_api_qxmlname.cpp @@ -0,0 +1,8 @@ +// Fills the bits from begin to end with 1s and leaves the rest as 0. + +template<typename IntegralT> +inline IntegralT bitmask(IntegralT begin, IntegralT end) +{ + IntegralT filled_bits = (1 << (end - begin + 1)) - 1; + return filled_bits << begin; +} |