Eigen::internal::count_bits_impl< BitsType, EnableIf > Struct Template Reference

#include <MathFunctions.h>

Static Public Member Functions

static EIGEN_DEVICE_FUNC int clz (BitsType bits)
 
static EIGEN_DEVICE_FUNC int ctz (BitsType bits)
 

Member Function Documentation

◆ clz()

template<typename BitsType , typename EnableIf = void>
static EIGEN_DEVICE_FUNC int Eigen::internal::count_bits_impl< BitsType, EnableIf >::clz ( BitsType  bits)
inlinestatic
607  {
608  int n = CHAR_BIT * sizeof(BitsType);
609  int shift = n / 2;
610  while (bits > 0 && shift > 0) {
611  BitsType y = bits >> shift;
612  if (y > 0) {
613  n -= shift;
614  bits = y;
615  }
616  shift /= 2;
617  }
618  if (shift == 0) {
619  --n;
620  }
621  return n;
622  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
const Scalar & y
Definition: RandomImpl.h:36
Map< const Array< unsigned char, sizeof(T), 1 > > bits(const T &x)
Definition: packetmath_test_shared.h:36

References Eigen::test::bits(), n, and Eigen::internal::y.

Referenced by Eigen::internal::clz().

◆ ctz()

template<typename BitsType , typename EnableIf = void>
static EIGEN_DEVICE_FUNC int Eigen::internal::count_bits_impl< BitsType, EnableIf >::ctz ( BitsType  bits)
inlinestatic
624  {
625  int n = CHAR_BIT * sizeof(BitsType);
626  int shift = n / 2;
627  while (bits > 0 && shift > 0) {
628  BitsType y = bits << shift;
629  if (y > 0) {
630  n -= shift;
631  bits = y;
632  }
633  shift /= 2;
634  }
635  if (shift == 0) {
636  --n;
637  }
638  return n;
639  }

References Eigen::test::bits(), n, and Eigen::internal::y.

Referenced by Eigen::internal::ctz().


The documentation for this struct was generated from the following file: