Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 1 | /* |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 2 | * Copyright (C) 2011-2012 The Android Open Source Project |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Stephen Hines | 43cfc0c | 2013-08-15 10:02:11 -0700 | [diff] [blame] | 17 | #if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) |
Glenn Kasten | 72f4f4c | 2011-12-15 09:51:17 -0800 | [diff] [blame] | 18 | #include <cutils/compiler.h> |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 19 | #endif |
Glenn Kasten | 72f4f4c | 2011-12-15 09:51:17 -0800 | [diff] [blame] | 20 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 21 | #include "rsContext.h" |
| 22 | #include "rsScriptC.h" |
| 23 | #include "rsMatrix4x4.h" |
| 24 | #include "rsMatrix3x3.h" |
| 25 | #include "rsMatrix2x2.h" |
| 26 | |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 27 | #include "rsCpuCore.h" |
| 28 | #include "rsCpuScript.h" |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 29 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 30 | using namespace android; |
| 31 | using namespace android::renderscript; |
| 32 | |
Tim Murray | d6f1f46 | 2013-03-25 16:36:59 -0700 | [diff] [blame] | 33 | #define EXPORT_F32_FN_F32(func) \ |
| 34 | float __attribute__((overloadable)) SC_##func(float v) { \ |
| 35 | return func(v); \ |
| 36 | } |
| 37 | |
| 38 | #define EXPORT_F32_FN_F32_F32(func) \ |
| 39 | float __attribute__((overloadable)) SC_##func(float t, float v) { \ |
| 40 | return func(t, v); \ |
| 41 | } |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 42 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 43 | ////////////////////////////////////////////////////////////////////////////// |
| 44 | // Float util |
| 45 | ////////////////////////////////////////////////////////////////////////////// |
| 46 | |
Tim Murray | d6f1f46 | 2013-03-25 16:36:59 -0700 | [diff] [blame] | 47 | // Handle missing Gingerbread functions like tgammaf. |
| 48 | float SC_tgammaf(float x) { |
Stephen Hines | 11418c8 | 2013-08-14 16:46:21 -0700 | [diff] [blame] | 49 | #ifdef RS_COMPATIBILITY_LIB |
Tim Murray | d6f1f46 | 2013-03-25 16:36:59 -0700 | [diff] [blame] | 50 | return tgamma(x); |
Stephen Hines | 11418c8 | 2013-08-14 16:46:21 -0700 | [diff] [blame] | 51 | #else |
| 52 | return tgammaf(x); |
| 53 | #endif |
Tim Murray | d6f1f46 | 2013-03-25 16:36:59 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | uint32_t SC_abs_i32(int32_t v) {return abs(v);} |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 57 | |
| 58 | static void SC_MatrixLoadRotate(Matrix4x4 *m, float rot, float x, float y, float z) { |
| 59 | m->loadRotate(rot, x, y, z); |
| 60 | } |
| 61 | static void SC_MatrixLoadScale(Matrix4x4 *m, float x, float y, float z) { |
| 62 | m->loadScale(x, y, z); |
| 63 | } |
| 64 | static void SC_MatrixLoadTranslate(Matrix4x4 *m, float x, float y, float z) { |
| 65 | m->loadTranslate(x, y, z); |
| 66 | } |
| 67 | static void SC_MatrixRotate(Matrix4x4 *m, float rot, float x, float y, float z) { |
| 68 | m->rotate(rot, x, y, z); |
| 69 | } |
| 70 | static void SC_MatrixScale(Matrix4x4 *m, float x, float y, float z) { |
| 71 | m->scale(x, y, z); |
| 72 | } |
| 73 | static void SC_MatrixTranslate(Matrix4x4 *m, float x, float y, float z) { |
| 74 | m->translate(x, y, z); |
| 75 | } |
| 76 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 77 | static void SC_MatrixLoadOrtho(Matrix4x4 *m, float l, float r, float b, float t, float n, float f) { |
| 78 | m->loadOrtho(l, r, b, t, n, f); |
| 79 | } |
| 80 | static void SC_MatrixLoadFrustum(Matrix4x4 *m, float l, float r, float b, float t, float n, float f) { |
| 81 | m->loadFrustum(l, r, b, t, n, f); |
| 82 | } |
| 83 | static void SC_MatrixLoadPerspective(Matrix4x4 *m, float fovy, float aspect, float near, float far) { |
| 84 | m->loadPerspective(fovy, aspect, near, far); |
| 85 | } |
| 86 | |
| 87 | static bool SC_MatrixInverse_4x4(Matrix4x4 *m) { |
| 88 | return m->inverse(); |
| 89 | } |
| 90 | static bool SC_MatrixInverseTranspose_4x4(Matrix4x4 *m) { |
| 91 | return m->inverseTranspose(); |
| 92 | } |
| 93 | static void SC_MatrixTranspose_4x4(Matrix4x4 *m) { |
| 94 | m->transpose(); |
| 95 | } |
| 96 | static void SC_MatrixTranspose_3x3(Matrix3x3 *m) { |
| 97 | m->transpose(); |
| 98 | } |
| 99 | static void SC_MatrixTranspose_2x2(Matrix2x2 *m) { |
| 100 | m->transpose(); |
| 101 | } |
| 102 | |
Stephen Hines | b93cb42 | 2013-03-27 17:32:31 -0700 | [diff] [blame] | 103 | float SC_randf2(float min, float max) { |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 104 | float r = (float)rand(); |
Jason Sams | b8fa756 | 2011-04-22 14:19:42 -0700 | [diff] [blame] | 105 | r /= RAND_MAX; |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 106 | r = r * (max - min) + min; |
Jason Sams | b8fa756 | 2011-04-22 14:19:42 -0700 | [diff] [blame] | 107 | return r; |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 108 | } |
| 109 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 110 | static float SC_frac(float v) { |
| 111 | int i = (int)floor(v); |
| 112 | return fmin(v - i, 0x1.fffffep-1f); |
| 113 | } |
| 114 | |
Tim Murray | d6f1f46 | 2013-03-25 16:36:59 -0700 | [diff] [blame] | 115 | EXPORT_F32_FN_F32(acosf) |
| 116 | EXPORT_F32_FN_F32(acoshf) |
| 117 | EXPORT_F32_FN_F32(asinf) |
| 118 | EXPORT_F32_FN_F32(asinhf) |
| 119 | EXPORT_F32_FN_F32(atanf) |
| 120 | EXPORT_F32_FN_F32_F32(atan2f) |
| 121 | EXPORT_F32_FN_F32(atanhf) |
| 122 | EXPORT_F32_FN_F32(cbrtf) |
| 123 | EXPORT_F32_FN_F32(ceilf) |
| 124 | EXPORT_F32_FN_F32_F32(copysignf) |
| 125 | EXPORT_F32_FN_F32(cosf) |
| 126 | EXPORT_F32_FN_F32(coshf) |
| 127 | EXPORT_F32_FN_F32(erfcf) |
| 128 | EXPORT_F32_FN_F32(erff) |
| 129 | EXPORT_F32_FN_F32(expf) |
| 130 | EXPORT_F32_FN_F32(exp2f) |
| 131 | EXPORT_F32_FN_F32(expm1f) |
| 132 | EXPORT_F32_FN_F32_F32(fdimf) |
| 133 | EXPORT_F32_FN_F32(floorf) |
| 134 | float SC_fmaf(float u, float t, float v) {return fmaf(u, t, v);} |
| 135 | EXPORT_F32_FN_F32_F32(fmaxf) |
| 136 | EXPORT_F32_FN_F32_F32(fminf) |
| 137 | EXPORT_F32_FN_F32_F32(fmodf) |
| 138 | float SC_frexpf(float v, int* ptr) {return frexpf(v, ptr);} |
| 139 | EXPORT_F32_FN_F32_F32(hypotf) |
Pirama Arumuga Nainar | 6fdd060 | 2015-01-13 11:21:13 -0800 | [diff] [blame] | 140 | int SC_ilogbf(float v) {return ilogbf(v); } |
Tim Murray | d6f1f46 | 2013-03-25 16:36:59 -0700 | [diff] [blame] | 141 | float SC_ldexpf(float v, int i) {return ldexpf(v, i);} |
| 142 | EXPORT_F32_FN_F32(lgammaf) |
| 143 | float SC_lgammaf_r(float v, int* ptr) {return lgammaf_r(v, ptr);} |
| 144 | EXPORT_F32_FN_F32(logf) |
| 145 | EXPORT_F32_FN_F32(log10f) |
| 146 | EXPORT_F32_FN_F32(log1pf) |
| 147 | EXPORT_F32_FN_F32(logbf) |
| 148 | float SC_modff(float v, float* ptr) {return modff(v, ptr);} |
| 149 | EXPORT_F32_FN_F32_F32(nextafterf) |
| 150 | EXPORT_F32_FN_F32_F32(powf) |
| 151 | EXPORT_F32_FN_F32_F32(remainderf) |
| 152 | float SC_remquof(float t, float v, int* ptr) {return remquof(t, v, ptr);} |
| 153 | EXPORT_F32_FN_F32(rintf) |
| 154 | EXPORT_F32_FN_F32(roundf) |
| 155 | EXPORT_F32_FN_F32(sinf) |
| 156 | EXPORT_F32_FN_F32(sinhf) |
| 157 | EXPORT_F32_FN_F32(sqrtf) |
| 158 | EXPORT_F32_FN_F32(tanf) |
| 159 | EXPORT_F32_FN_F32(tanhf) |
| 160 | EXPORT_F32_FN_F32(truncf) |
Stephen Hines | cadee38 | 2013-12-12 13:21:00 -0800 | [diff] [blame] | 161 | float __attribute__((overloadable)) rsFrac(float f) { |
| 162 | return SC_frac(f); |
| 163 | } |
| 164 | void __attribute__((overloadable)) rsMatrixLoadRotate(rs_matrix4x4 *m, |
| 165 | float rot, float x, float y, float z) { |
| 166 | SC_MatrixLoadRotate((Matrix4x4 *) m, rot, x, y, z); |
| 167 | } |
| 168 | void __attribute__((overloadable)) rsMatrixLoadScale(rs_matrix4x4 *m, |
| 169 | float x, float y, float z) { |
| 170 | SC_MatrixLoadScale((Matrix4x4 *) m, x, y, z); |
| 171 | } |
| 172 | void __attribute__((overloadable)) rsMatrixLoadTranslate(rs_matrix4x4 *m, |
| 173 | float x, float y, float z) { |
| 174 | SC_MatrixLoadTranslate((Matrix4x4 *) m, x, y, z); |
| 175 | } |
| 176 | void __attribute__((overloadable)) rsMatrixRotate(rs_matrix4x4 *m, float rot, |
| 177 | float x, float y, float z) { |
| 178 | SC_MatrixRotate((Matrix4x4 *) m, rot, x, y, z); |
| 179 | } |
| 180 | void __attribute__((overloadable)) rsMatrixScale(rs_matrix4x4 *m, float x, |
| 181 | float y, float z) { |
| 182 | SC_MatrixScale((Matrix4x4 *) m, x, y, z); |
| 183 | } |
| 184 | void __attribute__((overloadable)) rsMatrixTranslate(rs_matrix4x4 *m, float x, |
| 185 | float y, float z) { |
| 186 | SC_MatrixTranslate((Matrix4x4 *) m, x, y, z); |
| 187 | } |
| 188 | void __attribute__((overloadable)) rsMatrixLoadOrtho(rs_matrix4x4 *m, float l, |
| 189 | float r, float b, float t, float n, float f) { |
| 190 | SC_MatrixLoadOrtho((Matrix4x4 *) m, l, r, b, t, n, f); |
| 191 | } |
| 192 | void __attribute__((overloadable)) rsMatrixLoadFrustum(rs_matrix4x4 *m, |
| 193 | float l, float r, float b, float t, float n, float f) { |
| 194 | SC_MatrixLoadFrustum((Matrix4x4 *) m, l, r, b, t, n, f); |
| 195 | } |
| 196 | void __attribute__((overloadable)) rsMatrixLoadPerspective(rs_matrix4x4 *m, |
| 197 | float fovy, float aspect, float near, float far) { |
| 198 | SC_MatrixLoadPerspective((Matrix4x4 *) m, fovy, aspect, near, far); |
| 199 | } |
| 200 | bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m) { |
| 201 | return SC_MatrixInverse_4x4((Matrix4x4 *) m); |
| 202 | } |
| 203 | bool __attribute__((overloadable)) rsMatrixInverseTranspose(rs_matrix4x4 *m) { |
| 204 | return SC_MatrixInverseTranspose_4x4((Matrix4x4 *) m); |
| 205 | } |
| 206 | void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix4x4 *m) { |
| 207 | SC_MatrixTranspose_4x4((Matrix4x4 *) m); |
| 208 | } |
| 209 | void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix3x3 *m) { |
| 210 | SC_MatrixTranspose_3x3((Matrix3x3 *) m); |
| 211 | } |
| 212 | void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix2x2 *m) { |
| 213 | SC_MatrixTranspose_2x2((Matrix2x2 *) m); |
| 214 | } |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 215 | |
| 216 | ////////////////////////////////////////////////////////////////////////////// |
| 217 | // Class implementation |
| 218 | ////////////////////////////////////////////////////////////////////////////// |
| 219 | |
| 220 | // llvm name mangling ref |
| 221 | // <builtin-type> ::= v # void |
| 222 | // ::= b # bool |
| 223 | // ::= c # char |
| 224 | // ::= a # signed char |
| 225 | // ::= h # unsigned char |
| 226 | // ::= s # short |
| 227 | // ::= t # unsigned short |
| 228 | // ::= i # int |
| 229 | // ::= j # unsigned int |
| 230 | // ::= l # long |
| 231 | // ::= m # unsigned long |
| 232 | // ::= x # long long, __int64 |
| 233 | // ::= y # unsigned long long, __int64 |
| 234 | // ::= f # float |
| 235 | // ::= d # double |
| 236 | |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 237 | static RsdCpuReference::CpuSymbol gSyms[] = { |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 238 | { "_Z4acosf", (void *)&acosf, true }, |
| 239 | { "_Z5acoshf", (void *)&acoshf, true }, |
| 240 | { "_Z4asinf", (void *)&asinf, true }, |
| 241 | { "_Z5asinhf", (void *)&asinhf, true }, |
| 242 | { "_Z4atanf", (void *)&atanf, true }, |
| 243 | { "_Z5atan2ff", (void *)&atan2f, true }, |
| 244 | { "_Z5atanhf", (void *)&atanhf, true }, |
| 245 | { "_Z4cbrtf", (void *)&cbrtf, true }, |
| 246 | { "_Z4ceilf", (void *)&ceilf, true }, |
| 247 | { "_Z8copysignff", (void *)©signf, true }, |
| 248 | { "_Z3cosf", (void *)&cosf, true }, |
| 249 | { "_Z4coshf", (void *)&coshf, true }, |
| 250 | { "_Z4erfcf", (void *)&erfcf, true }, |
| 251 | { "_Z3erff", (void *)&erff, true }, |
| 252 | { "_Z3expf", (void *)&expf, true }, |
| 253 | { "_Z4exp2f", (void *)&exp2f, true }, |
Tim Murray | 6a9cc72 | 2014-05-30 15:07:30 -0700 | [diff] [blame] | 254 | { "exp2f", (void *)&exp2f, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 255 | { "_Z5expm1f", (void *)&expm1f, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 256 | { "_Z4fdimff", (void *)&fdimf, true }, |
| 257 | { "_Z5floorf", (void *)&floorf, true }, |
| 258 | { "_Z3fmafff", (void *)&fmaf, true }, |
| 259 | { "_Z4fmaxff", (void *)&fmaxf, true }, |
| 260 | { "_Z4fminff", (void *)&fminf, true }, // float fmin(float, float) |
| 261 | { "_Z4fmodff", (void *)&fmodf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 262 | { "_Z5frexpfPi", (void *)&frexpf, true }, |
| 263 | { "_Z5hypotff", (void *)&hypotf, true }, |
| 264 | { "_Z5ilogbf", (void *)&ilogbf, true }, |
| 265 | { "_Z5ldexpfi", (void *)&ldexpf, true }, |
| 266 | { "_Z6lgammaf", (void *)&lgammaf, true }, |
| 267 | { "_Z6lgammafPi", (void *)&lgammaf_r, true }, |
| 268 | { "_Z3logf", (void *)&logf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 269 | { "_Z5log10f", (void *)&log10f, true }, |
| 270 | { "_Z5log1pf", (void *)&log1pf, true }, |
| 271 | { "_Z4logbf", (void *)&logbf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 272 | { "_Z4modffPf", (void *)&modff, true }, |
| 273 | //{ "_Z3nanj", (void *)&SC_nan, true }, |
| 274 | { "_Z9nextafterff", (void *)&nextafterf, true }, |
| 275 | { "_Z3powff", (void *)&powf, true }, |
Tim Murray | 60fe47d | 2014-05-27 13:29:32 -0700 | [diff] [blame] | 276 | { "powf", (void *)&powf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 277 | { "_Z9remainderff", (void *)&remainderf, true }, |
| 278 | { "_Z6remquoffPi", (void *)&remquof, true }, |
| 279 | { "_Z4rintf", (void *)&rintf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 280 | { "_Z5roundf", (void *)&roundf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 281 | { "_Z3sinf", (void *)&sinf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 282 | { "_Z4sinhf", (void *)&sinhf, true }, |
| 283 | { "_Z4sqrtf", (void *)&sqrtf, true }, |
| 284 | { "_Z3tanf", (void *)&tanf, true }, |
| 285 | { "_Z4tanhf", (void *)&tanhf, true }, |
Stephen Hines | 11418c8 | 2013-08-14 16:46:21 -0700 | [diff] [blame] | 286 | { "_Z6tgammaf", (void *)&SC_tgammaf, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 287 | { "_Z5truncf", (void *)&truncf, true }, |
| 288 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 289 | //{ "smoothstep", (void *)&, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 290 | |
| 291 | // matrix |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 292 | { "_Z18rsMatrixLoadRotateP12rs_matrix4x4ffff", (void *)&SC_MatrixLoadRotate, true }, |
| 293 | { "_Z17rsMatrixLoadScaleP12rs_matrix4x4fff", (void *)&SC_MatrixLoadScale, true }, |
| 294 | { "_Z21rsMatrixLoadTranslateP12rs_matrix4x4fff", (void *)&SC_MatrixLoadTranslate, true }, |
| 295 | { "_Z14rsMatrixRotateP12rs_matrix4x4ffff", (void *)&SC_MatrixRotate, true }, |
| 296 | { "_Z13rsMatrixScaleP12rs_matrix4x4fff", (void *)&SC_MatrixScale, true }, |
| 297 | { "_Z17rsMatrixTranslateP12rs_matrix4x4fff", (void *)&SC_MatrixTranslate, true }, |
| 298 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 299 | { "_Z17rsMatrixLoadOrthoP12rs_matrix4x4ffffff", (void *)&SC_MatrixLoadOrtho, true }, |
| 300 | { "_Z19rsMatrixLoadFrustumP12rs_matrix4x4ffffff", (void *)&SC_MatrixLoadFrustum, true }, |
| 301 | { "_Z23rsMatrixLoadPerspectiveP12rs_matrix4x4ffff", (void *)&SC_MatrixLoadPerspective, true }, |
| 302 | |
| 303 | { "_Z15rsMatrixInverseP12rs_matrix4x4", (void *)&SC_MatrixInverse_4x4, true }, |
| 304 | { "_Z24rsMatrixInverseTransposeP12rs_matrix4x4", (void *)&SC_MatrixInverseTranspose_4x4, true }, |
| 305 | { "_Z17rsMatrixTransposeP12rs_matrix4x4", (void *)&SC_MatrixTranspose_4x4, true }, |
yuyan | c84b56e | 2012-09-11 15:10:14 +0800 | [diff] [blame] | 306 | { "_Z17rsMatrixTransposeP12rs_matrix3x3", (void *)&SC_MatrixTranspose_3x3, true }, |
| 307 | { "_Z17rsMatrixTransposeP12rs_matrix2x2", (void *)&SC_MatrixTranspose_2x2, true }, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 308 | |
| 309 | // RS Math |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 310 | { "_Z6rsRandff", (void *)&SC_randf2, true }, |
| 311 | { "_Z6rsFracf", (void *)&SC_frac, true }, |
| 312 | |
Chris Wailes | 44bef6f | 2014-08-12 13:51:10 -0700 | [diff] [blame] | 313 | { nullptr, nullptr, false } |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 316 | const RsdCpuReference::CpuSymbol * RsdCpuScriptImpl::lookupSymbolMath(const char *sym) { |
| 317 | const RsdCpuReference::CpuSymbol *syms = gSyms; |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 318 | |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 319 | while (syms->fnPtr) { |
| 320 | if (!strcmp(syms->name, sym)) { |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 321 | return syms; |
| 322 | } |
| 323 | syms++; |
| 324 | } |
Chris Wailes | 44bef6f | 2014-08-12 13:51:10 -0700 | [diff] [blame] | 325 | return nullptr; |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 326 | } |
| 327 | |