int_floor_sqrt_helper< I > Struct Template Reference

#include <int.hpp>

List of all members.

Static Public Member Functions


Detailed Description

template<typename I>
struct mmx::int_floor_sqrt_helper< I >

Definition at line 459 of file int.hpp.


Member Function Documentation

static I floor_sqrt ( const I &  x  )  [inline, static]

Definition at line 460 of file int.hpp.

References ASSERT, and mmx::I().

00460                                    {
00461     ASSERT (x >= 0, "wrong sign");
00462     I y= x, r= 0, b= ((I) 1) << (8 * sizeof (I) - 2);
00463     while (b > y) b >>= 2;
00464     while (b != 0) {
00465         if (y >= r + b) { y -= r + b; r = (r >> 1) + b; }
00466         else r >>= 1;
00467         b >>= 2;
00468     }
00469     return r; }


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

Generated on 6 Dec 2012 for basix by  doxygen 1.6.1