File indexing completed on 2026-08-06 09:25:33
0001
0002
0003
0004
0005 #include <ninja/num_defs.hh>
0006
0007 namespace {
0008
0009 typedef ninja::Complex NinjaAbbrType;
0010
0011 const ninja::Real NINJAZERO(0);
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 template <typename T>
0029 inline T powi1(const T & x)
0030 {
0031 return x;
0032 }
0033 template <typename T>
0034 inline T powi2(const T & x)
0035 {
0036 return x*x;
0037 }
0038 template <typename T>
0039 inline T powi3(const T & x)
0040 {
0041 return x*x*x;
0042 }
0043 template <typename T>
0044 inline T powi4(const T & x)
0045 {
0046 T temp = x*x;
0047 return temp*temp;
0048 }
0049 template <typename T>
0050 inline T powi5(const T & x)
0051 {
0052 T temp = x*x;
0053 return temp*temp*x;
0054 }
0055 template <typename T>
0056 inline T powi6(const T & x)
0057 {
0058 T temp = x*x*x;
0059 return temp*temp;
0060 }
0061 template <typename T>
0062 inline T powi7(const T & x)
0063 {
0064 T temp = x*x*x;
0065 return temp*temp*x;
0066 }
0067 template <typename T>
0068 inline T powi8(const T & x)
0069 {
0070 T temp = x*x;
0071 temp *= temp;
0072 return temp*temp;
0073 }
0074 template <typename T>
0075 inline T powi9(const T & x)
0076 {
0077 T temp = x*x*x;
0078 return temp*temp*temp;
0079 }
0080 template <typename T>
0081 inline T powi(T x, unsigned y)
0082 {
0083 T res(1);
0084 while (y) {
0085 if (y & 1)
0086 res *= x;
0087 x *= x;
0088 y >>= 1;
0089 }
0090 return res;
0091 }
0092
0093
0094 template <typename T, typename U>
0095 inline ninja::Complex ninjaMP(const T & p, const U & u)
0096 {
0097 return ninja::mp(p,u);
0098 }
0099
0100 }