少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#include "il2cpp-config.h"
#include <cmath>
#include <limits>
#include <float.h>
#include "icalls/mscorlib/System/Math.h"
#include "vm/Exception.h"
 
namespace il2cpp
{
namespace icalls
{
namespace mscorlib
{
namespace System
{
    double Math::Acos(double val)
    {
        return acos(val);
    }
 
    double Math::Asin(double val)
    {
        return asin(val);
    }
 
    double Math::Atan(double val)
    {
        return atan(val);
    }
 
    double Math::Atan2(double y, double x)
    {
        return atan2(y, x);
    }
 
    double Math::Cos(double val)
    {
        return cos(val);
    }
 
    double Math::Cosh(double val)
    {
        return cosh(val);
    }
 
    double Math::Exp(double val)
    {
        return exp(val);
    }
 
    double Math::Floor(double x)
    {
        return floor(x);
    }
 
    double Math::Log(double x)
    {
        IL2CPP_NOT_IMPLEMENTED_ICALL_NO_ASSERT(Math::Log, "Determin what value of NAN to use");
 
        if (x == 0)
            return -HUGE_VAL;
        else if (x < 0)
            return std::numeric_limits<double>::signaling_NaN();
        //return NAN;
 
        return log(x);
    }
 
    double Math::Log10(double val)
    {
        return log10(val);
    }
 
    static bool IsInteger(double value)
    {
        double unused;
        return std::modf(value, &unused) == 0.0;
    }
 
    double Math::Pow(double val, double exp)
    {
        if (std::isnan(val))
            return val;
        if (std::isnan(exp))
            return exp;
 
        if (val > -1 && val < 1 && exp == -std::numeric_limits<double>::infinity())
            return std::numeric_limits<double>::infinity();
 
        if (val > -1 && val < 1 && exp == std::numeric_limits<double>::infinity())
            return 0.0;
 
        if ((val < -1 || val > 1) && exp == -std::numeric_limits<double>::infinity())
            return 0.0;
 
        if ((val < -1 || val > 1) && exp == std::numeric_limits<double>::infinity())
            return std::numeric_limits<double>::infinity();
 
        if (val < 0)
        {
            if (!IsInteger(exp) || exp == std::numeric_limits<double>::infinity() || exp == -std::numeric_limits<double>::infinity())
                return std::numeric_limits<double>::quiet_NaN();
        }
 
        double res = pow(val, exp);
        if (std::isnan(res))
            return 1.0;
 
        if (res == -0.0)
            return 0.0;
 
        return res;
    }
 
    double Math::Round(double x)
    {
        double int_part, dec_part;
        int_part = floor(x);
        dec_part = x - int_part;
        if (((dec_part == 0.5) &&
             ((2.0 * ((int_part / 2.0) - floor(int_part / 2.0))) != 0.0)) ||
            (dec_part > 0.5))
        {
            int_part++;
        }
        return int_part;
    }
 
    double Math::Sin(double val)
    {
        return sin(val);
    }
 
    double Math::Sinh(double val)
    {
        return sinh(val);
    }
 
    double Math::Sqrt(double val)
    {
        return sqrt(val);
    }
 
    double Math::Tan(double val)
    {
        return tan(val);
    }
 
    double Math::Tanh(double val)
    {
        return tanh(val);
    }
 
    double Math::Round2(double value, int32_t digits, bool away_from_zero)
    {
        double p;
        if (value == HUGE_VAL)
            return HUGE_VAL;
        if (value == -HUGE_VAL)
            return -HUGE_VAL;
        if (digits == 0 && !away_from_zero)
            return Round(value);
 
        p = pow(10.0, digits);
 
// Note: Migrate to C++11 when possible
#if 0
        if (away_from_zero)
            return std::round(value * p) / p;
        else
            return std::rint(value * p) / p;
#else
        if (away_from_zero)
            return (value >= 0.0) ? floor(value * p + 0.5) / p : ceil(value * p - 0.5) / p;
        else
            return (value >= 0.0) ? ceil(value * p - 0.5) / p : floor(value * p + 0.5) / p;
#endif
    }
 
    double Math::Abs(double value)
    {
        return fabs(value);
    }
 
    double Math::Ceiling(double a)
    {
        return ceil(a);
    }
 
    double Math::SplitFractionDouble(double* value)
    {
        return modf(*value, value);
    }
 
    float Math::Abs(float value)
    {
        return fabsf(value);
    }
} /* namespace System */
} /* namespace mscorlib */
} /* namespace icalls */
} /* namespace il2cpp */