.. # split from OESystemFunctions.rst:975

.. include:: ../substitutions

.. oe:namespace:: OESystem

.. meta::
   :keywords: OEGetBitCounts

.. oe:function:: OEGetBitCounts

   .. oe:language:: c++ java csharp

      .. oe:api::

         void OEGetBitCounts(const OEBitVector& a, const OEBitVector& b,
                             unsigned int* onlyA, unsigned int* onlyB,
                             unsigned int* bothAB)
         void OEGetBitCounts(const OEBitVector& a, const OEBitVector& b,
                             unsigned int* onlyA, unsigned int* onlyB,
                             unsigned int* bothAB, unsigned int* neitherAB)

   .. oe:language:: python

      .. oe:api:: python

         OEGetBitCounts(a: OEBitVector, b: OEBitVector) -> (onlyA: int, onlyB: int, bothAB: int, neitherAB: int)

   Count the number of bits when comparing the two
   :ref:`OEBitVector <OESystem_OEBitVector>` arguments ``a`` and ``b``. This
   function is optimized so that the bitvectors only need to be
   traversed once.

   The counts are returned as the following arguments with the
   corresponding values.

   .. code-block:: c++

      *onlyA     =   a  & ~b;
      *onlyB     =  ~a  &  b;
      *bothAB    =   a  &  b;
      *neitherAB = ~(a  &  b);

   .. seealso::

      These values correspond with the **a**, **b**, **c**, **d**
      values found on the `Daylight theory page
      <http://www.daylight.com/dayhtml/doc/theory/theory.finger.html#RTFToC83>`_.

