libstdc++
GNU C++ library
Loading...
Searching...
No Matches

◆ __power() [2/2]

template<typename _Tp, typename _Integer, typename _MonoidOperation>
_Tp __gnu_cxx::__power ( _Tp __x,
_Integer __n,
_MonoidOperation __monoid_op )

Definition at line 78 of file ext/numeric.

79 {
80 if (__n == 0)
81 return identity_element(__monoid_op);
82 else
83 {
84 while ((__n & 1) == 0)
85 {
86 __n >>= 1;
87 __x = __monoid_op(__x, __x);
88 }
89
90 _Tp __result = __x;
91 __n >>= 1;
92 while (__n != 0)
93 {
94 __x = __monoid_op(__x, __x);
95 if ((__n & 1) != 0)
96 __result = __monoid_op(__result, __x);
97 __n >>= 1;
98 }
99 return __result;
100 }
101 }
rope< _CharT, _Alloc > identity_element(_Rope_Concat_fn< _CharT, _Alloc >)
Definition rope:466

References identity_element.

Referenced by __power(), power(), and power().

Here is the caller graph for this function: