1/* 2 * Copyright (C) 2011 The Android Open Source Project 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 17#include <cutils/compiler.h> 18 19#include "rsContext.h" 20#include "rsScriptC.h" 21#include "rsMatrix4x4.h" 22#include "rsMatrix3x3.h" 23#include "rsMatrix2x2.h" 24 25#include "rsdCore.h" 26#include "rsdRuntime.h" 27 28 29using namespace android; 30using namespace android::renderscript; 31 32 33static float SC_exp10(float v) { 34 return pow(10.f, v); 35} 36 37static float SC_fract(float v, float *iptr) { 38 int i = (int)floor(v); 39 iptr[0] = (float)i; 40 return fmin(v - i, 0x1.fffffep-1f); 41} 42 43static float SC_log2(float v) { 44 return log10(v) / log10(2.f); 45} 46 47#if 0 48static float SC_pown(float v, int p) { 49 return powf(v, (float)p); 50} 51 52static float SC_powr(float v, float p) { 53 return powf(v, p); 54} 55#endif 56 57float SC_rootn(float v, int r) { 58 return pow(v, 1.f / r); 59} 60 61float SC_rsqrt(float v) { 62 return 1.f / sqrtf(v); 63} 64 65float SC_sincos(float v, float *cosptr) { 66 *cosptr = cosf(v); 67 return sinf(v); 68} 69 70////////////////////////////////////////////////////////////////////////////// 71// Integer 72////////////////////////////////////////////////////////////////////////////// 73 74 75static uint32_t SC_abs_i32(int32_t v) {return abs(v);} 76static uint16_t SC_abs_i16(int16_t v) {return (uint16_t)abs(v);} 77static uint8_t SC_abs_i8(int8_t v) {return (uint8_t)abs(v);} 78 79static uint32_t SC_clz_u32(uint32_t v) {return __builtin_clz(v);} 80static uint16_t SC_clz_u16(uint16_t v) {return (uint16_t)__builtin_clz(v);} 81static uint8_t SC_clz_u8(uint8_t v) {return (uint8_t)__builtin_clz(v);} 82static int32_t SC_clz_i32(int32_t v) {return (int32_t)__builtin_clz((uint32_t)v);} 83static int16_t SC_clz_i16(int16_t v) {return (int16_t)__builtin_clz(v);} 84static int8_t SC_clz_i8(int8_t v) {return (int8_t)__builtin_clz(v);} 85 86static uint32_t SC_max_u32(uint32_t v, uint32_t v2) {return rsMax(v, v2);} 87static uint16_t SC_max_u16(uint16_t v, uint16_t v2) {return rsMax(v, v2);} 88static uint8_t SC_max_u8(uint8_t v, uint8_t v2) {return rsMax(v, v2);} 89static int32_t SC_max_i32(int32_t v, int32_t v2) {return rsMax(v, v2);} 90static int16_t SC_max_i16(int16_t v, int16_t v2) {return rsMax(v, v2);} 91static int8_t SC_max_i8(int8_t v, int8_t v2) {return rsMax(v, v2);} 92 93static uint32_t SC_min_u32(uint32_t v, uint32_t v2) {return rsMin(v, v2);} 94static uint16_t SC_min_u16(uint16_t v, uint16_t v2) {return rsMin(v, v2);} 95static uint8_t SC_min_u8(uint8_t v, uint8_t v2) {return rsMin(v, v2);} 96static int32_t SC_min_i32(int32_t v, int32_t v2) {return rsMin(v, v2);} 97static int16_t SC_min_i16(int16_t v, int16_t v2) {return rsMin(v, v2);} 98static int8_t SC_min_i8(int8_t v, int8_t v2) {return rsMin(v, v2);} 99 100////////////////////////////////////////////////////////////////////////////// 101// Float util 102////////////////////////////////////////////////////////////////////////////// 103 104static float SC_clamp_f32(float amount, float low, float high) { 105 return amount < low ? low : (amount > high ? high : amount); 106} 107 108static float SC_max_f32(float v, float v2) { 109 return rsMax(v, v2); 110} 111 112static float SC_min_f32(float v, float v2) { 113 return rsMin(v, v2); 114} 115 116static float SC_step_f32(float edge, float v) { 117 if (v < edge) return 0.f; 118 return 1.f; 119} 120 121static float SC_sign_f32(float value) { 122 if (value > 0) return 1.f; 123 if (value < 0) return -1.f; 124 return value; 125} 126 127static void SC_MatrixLoadIdentity_4x4(Matrix4x4 *m) { 128 m->loadIdentity(); 129} 130static void SC_MatrixLoadIdentity_3x3(Matrix3x3 *m) { 131 m->loadIdentity(); 132} 133static void SC_MatrixLoadIdentity_2x2(Matrix2x2 *m) { 134 m->loadIdentity(); 135} 136 137static void SC_MatrixLoad_4x4_f(Matrix4x4 *m, const float *f) { 138 m->load(f); 139} 140static void SC_MatrixLoad_3x3_f(Matrix3x3 *m, const float *f) { 141 m->load(f); 142} 143static void SC_MatrixLoad_2x2_f(Matrix2x2 *m, const float *f) { 144 m->load(f); 145} 146 147static void SC_MatrixLoad_4x4_4x4(Matrix4x4 *m, const Matrix4x4 *s) { 148 m->load(s); 149} 150static void SC_MatrixLoad_4x4_3x3(Matrix4x4 *m, const Matrix3x3 *s) { 151 m->load(s); 152} 153static void SC_MatrixLoad_4x4_2x2(Matrix4x4 *m, const Matrix2x2 *s) { 154 m->load(s); 155} 156static void SC_MatrixLoad_3x3_3x3(Matrix3x3 *m, const Matrix3x3 *s) { 157 m->load(s); 158} 159static void SC_MatrixLoad_2x2_2x2(Matrix2x2 *m, const Matrix2x2 *s) { 160 m->load(s); 161} 162 163static void SC_MatrixLoadRotate(Matrix4x4 *m, float rot, float x, float y, float z) { 164 m->loadRotate(rot, x, y, z); 165} 166static void SC_MatrixLoadScale(Matrix4x4 *m, float x, float y, float z) { 167 m->loadScale(x, y, z); 168} 169static void SC_MatrixLoadTranslate(Matrix4x4 *m, float x, float y, float z) { 170 m->loadTranslate(x, y, z); 171} 172static void SC_MatrixRotate(Matrix4x4 *m, float rot, float x, float y, float z) { 173 m->rotate(rot, x, y, z); 174} 175static void SC_MatrixScale(Matrix4x4 *m, float x, float y, float z) { 176 m->scale(x, y, z); 177} 178static void SC_MatrixTranslate(Matrix4x4 *m, float x, float y, float z) { 179 m->translate(x, y, z); 180} 181 182static void SC_MatrixLoadMultiply_4x4_4x4_4x4(Matrix4x4 *m, const Matrix4x4 *lhs, const Matrix4x4 *rhs) { 183 m->loadMultiply(lhs, rhs); 184} 185static void SC_MatrixLoadMultiply_3x3_3x3_3x3(Matrix3x3 *m, const Matrix3x3 *lhs, const Matrix3x3 *rhs) { 186 m->loadMultiply(lhs, rhs); 187} 188static void SC_MatrixLoadMultiply_2x2_2x2_2x2(Matrix2x2 *m, const Matrix2x2 *lhs, const Matrix2x2 *rhs) { 189 m->loadMultiply(lhs, rhs); 190} 191 192static void SC_MatrixMultiply_4x4_4x4(Matrix4x4 *m, const Matrix4x4 *rhs) { 193 m->multiply(rhs); 194} 195static void SC_MatrixMultiply_3x3_3x3(Matrix3x3 *m, const Matrix3x3 *rhs) { 196 m->multiply(rhs); 197} 198static void SC_MatrixMultiply_2x2_2x2(Matrix2x2 *m, const Matrix2x2 *rhs) { 199 m->multiply(rhs); 200} 201 202static void SC_MatrixLoadOrtho(Matrix4x4 *m, float l, float r, float b, float t, float n, float f) { 203 m->loadOrtho(l, r, b, t, n, f); 204} 205static void SC_MatrixLoadFrustum(Matrix4x4 *m, float l, float r, float b, float t, float n, float f) { 206 m->loadFrustum(l, r, b, t, n, f); 207} 208static void SC_MatrixLoadPerspective(Matrix4x4 *m, float fovy, float aspect, float near, float far) { 209 m->loadPerspective(fovy, aspect, near, far); 210} 211 212static bool SC_MatrixInverse_4x4(Matrix4x4 *m) { 213 return m->inverse(); 214} 215static bool SC_MatrixInverseTranspose_4x4(Matrix4x4 *m) { 216 return m->inverseTranspose(); 217} 218static void SC_MatrixTranspose_4x4(Matrix4x4 *m) { 219 m->transpose(); 220} 221static void SC_MatrixTranspose_3x3(Matrix3x3 *m) { 222 m->transpose(); 223} 224static void SC_MatrixTranspose_2x2(Matrix2x2 *m) { 225 m->transpose(); 226} 227 228static float SC_randf(float max) { 229 float r = (float)rand(); 230 r *= max; 231 r /= RAND_MAX; 232 return r; 233} 234 235static float SC_randf2(float min, float max) { 236 float r = (float)rand(); 237 r /= RAND_MAX; 238 r = r * (max - min) + min; 239 return r; 240} 241 242static int SC_randi(int max) { 243 return (int)SC_randf(max); 244} 245 246static int SC_randi2(int min, int max) { 247 return (int)SC_randf2(min, max); 248} 249 250static float SC_frac(float v) { 251 int i = (int)floor(v); 252 return fmin(v - i, 0x1.fffffep-1f); 253} 254 255 256static int32_t SC_AtomicCas(volatile int32_t *ptr, int32_t expectedValue, int32_t newValue) { 257 int32_t prev; 258 259 do { 260 int32_t ret = android_atomic_release_cas(expectedValue, newValue, ptr); 261 if (!ret) { 262 // The android cas return 0 if it wrote the value. This means the 263 // previous value was the expected value and we can return. 264 return expectedValue; 265 } 266 // We didn't write the value and need to load the "previous" value. 267 prev = *ptr; 268 269 // A race condition exists where the expected value could appear after our cas failed 270 // above. In this case loop until we have a legit previous value or the 271 // write passes. 272 } while (prev == expectedValue); 273 return prev; 274} 275 276 277static int32_t SC_AtomicInc(volatile int32_t *ptr) { 278 return android_atomic_inc(ptr); 279} 280 281static int32_t SC_AtomicDec(volatile int32_t *ptr) { 282 return android_atomic_dec(ptr); 283} 284 285static int32_t SC_AtomicAdd(volatile int32_t *ptr, int32_t value) { 286 return android_atomic_add(value, ptr); 287} 288 289static int32_t SC_AtomicSub(volatile int32_t *ptr, int32_t value) { 290 int32_t prev, status; 291 do { 292 prev = *ptr; 293 status = android_atomic_release_cas(prev, prev - value, ptr); 294 } while (CC_UNLIKELY(status != 0)); 295 return prev; 296} 297 298static int32_t SC_AtomicAnd(volatile int32_t *ptr, int32_t value) { 299 return android_atomic_and(value, ptr); 300} 301 302static int32_t SC_AtomicOr(volatile int32_t *ptr, int32_t value) { 303 return android_atomic_or(value, ptr); 304} 305 306static int32_t SC_AtomicXor(volatile int32_t *ptr, int32_t value) { 307 int32_t prev, status; 308 do { 309 prev = *ptr; 310 status = android_atomic_release_cas(prev, prev ^ value, ptr); 311 } while (CC_UNLIKELY(status != 0)); 312 return prev; 313} 314 315static uint32_t SC_AtomicUMin(volatile uint32_t *ptr, uint32_t value) { 316 uint32_t prev, status; 317 do { 318 prev = *ptr; 319 uint32_t n = rsMin(value, prev); 320 status = android_atomic_release_cas((int32_t) prev, (int32_t)n, (volatile int32_t*) ptr); 321 } while (CC_UNLIKELY(status != 0)); 322 return prev; 323} 324 325static int32_t SC_AtomicMin(volatile int32_t *ptr, int32_t value) { 326 int32_t prev, status; 327 do { 328 prev = *ptr; 329 int32_t n = rsMin(value, prev); 330 status = android_atomic_release_cas(prev, n, ptr); 331 } while (CC_UNLIKELY(status != 0)); 332 return prev; 333} 334 335static uint32_t SC_AtomicUMax(volatile uint32_t *ptr, uint32_t value) { 336 uint32_t prev, status; 337 do { 338 prev = *ptr; 339 uint32_t n = rsMax(value, prev); 340 status = android_atomic_release_cas((int32_t) prev, (int32_t) n, (volatile int32_t*) ptr); 341 } while (CC_UNLIKELY(status != 0)); 342 return prev; 343} 344 345static int32_t SC_AtomicMax(volatile int32_t *ptr, int32_t value) { 346 int32_t prev, status; 347 do { 348 prev = *ptr; 349 int32_t n = rsMax(value, prev); 350 status = android_atomic_release_cas(prev, n, ptr); 351 } while (CC_UNLIKELY(status != 0)); 352 return prev; 353} 354 355 356 357////////////////////////////////////////////////////////////////////////////// 358// Class implementation 359////////////////////////////////////////////////////////////////////////////// 360 361// llvm name mangling ref 362// <builtin-type> ::= v # void 363// ::= b # bool 364// ::= c # char 365// ::= a # signed char 366// ::= h # unsigned char 367// ::= s # short 368// ::= t # unsigned short 369// ::= i # int 370// ::= j # unsigned int 371// ::= l # long 372// ::= m # unsigned long 373// ::= x # long long, __int64 374// ::= y # unsigned long long, __int64 375// ::= f # float 376// ::= d # double 377 378static RsdSymbolTable gSyms[] = { 379 { "_Z4acosf", (void *)&acosf, true }, 380 { "_Z5acoshf", (void *)&acoshf, true }, 381 { "_Z4asinf", (void *)&asinf, true }, 382 { "_Z5asinhf", (void *)&asinhf, true }, 383 { "_Z4atanf", (void *)&atanf, true }, 384 { "_Z5atan2ff", (void *)&atan2f, true }, 385 { "_Z5atanhf", (void *)&atanhf, true }, 386 { "_Z4cbrtf", (void *)&cbrtf, true }, 387 { "_Z4ceilf", (void *)&ceilf, true }, 388 { "_Z8copysignff", (void *)©signf, true }, 389 { "_Z3cosf", (void *)&cosf, true }, 390 { "_Z4coshf", (void *)&coshf, true }, 391 { "_Z4erfcf", (void *)&erfcf, true }, 392 { "_Z3erff", (void *)&erff, true }, 393 { "_Z3expf", (void *)&expf, true }, 394 { "_Z4exp2f", (void *)&exp2f, true }, 395 { "_Z5exp10f", (void *)&SC_exp10, true }, 396 { "_Z5expm1f", (void *)&expm1f, true }, 397 { "_Z4fabsf", (void *)&fabsf, true }, 398 { "_Z4fdimff", (void *)&fdimf, true }, 399 { "_Z5floorf", (void *)&floorf, true }, 400 { "_Z3fmafff", (void *)&fmaf, true }, 401 { "_Z4fmaxff", (void *)&fmaxf, true }, 402 { "_Z4fminff", (void *)&fminf, true }, // float fmin(float, float) 403 { "_Z4fmodff", (void *)&fmodf, true }, 404 { "_Z5fractfPf", (void *)&SC_fract, true }, 405 { "_Z5frexpfPi", (void *)&frexpf, true }, 406 { "_Z5hypotff", (void *)&hypotf, true }, 407 { "_Z5ilogbf", (void *)&ilogbf, true }, 408 { "_Z5ldexpfi", (void *)&ldexpf, true }, 409 { "_Z6lgammaf", (void *)&lgammaf, true }, 410 { "_Z6lgammafPi", (void *)&lgammaf_r, true }, 411 { "_Z3logf", (void *)&logf, true }, 412 { "_Z4log2f", (void *)&SC_log2, true }, 413 { "_Z5log10f", (void *)&log10f, true }, 414 { "_Z5log1pf", (void *)&log1pf, true }, 415 { "_Z4logbf", (void *)&logbf, true }, 416 { "_Z4modffPf", (void *)&modff, true }, 417 //{ "_Z3nanj", (void *)&SC_nan, true }, 418 { "_Z9nextafterff", (void *)&nextafterf, true }, 419 { "_Z3powff", (void *)&powf, true }, 420 { "_Z9remainderff", (void *)&remainderf, true }, 421 { "_Z6remquoffPi", (void *)&remquof, true }, 422 { "_Z4rintf", (void *)&rintf, true }, 423 { "_Z5rootnfi", (void *)&SC_rootn, true }, 424 { "_Z5roundf", (void *)&roundf, true }, 425 { "_Z5rsqrtf", (void *)&SC_rsqrt, true }, 426 { "_Z3sinf", (void *)&sinf, true }, 427 { "_Z6sincosfPf", (void *)&SC_sincos, true }, 428 { "_Z4sinhf", (void *)&sinhf, true }, 429 { "_Z4sqrtf", (void *)&sqrtf, true }, 430 { "_Z3tanf", (void *)&tanf, true }, 431 { "_Z4tanhf", (void *)&tanhf, true }, 432 { "_Z6tgammaf", (void *)&tgammaf, true }, 433 { "_Z5truncf", (void *)&truncf, true }, 434 435 { "_Z3absi", (void *)&SC_abs_i32, true }, 436 { "_Z3abss", (void *)&SC_abs_i16, true }, 437 { "_Z3absc", (void *)&SC_abs_i8, true }, 438 { "_Z3clzj", (void *)&SC_clz_u32, true }, 439 { "_Z3clzt", (void *)&SC_clz_u16, true }, 440 { "_Z3clzh", (void *)&SC_clz_u8, true }, 441 { "_Z3clzi", (void *)&SC_clz_i32, true }, 442 { "_Z3clzs", (void *)&SC_clz_i16, true }, 443 { "_Z3clzc", (void *)&SC_clz_i8, true }, 444 { "_Z3maxjj", (void *)&SC_max_u32, true }, 445 { "_Z3maxtt", (void *)&SC_max_u16, true }, 446 { "_Z3maxhh", (void *)&SC_max_u8, true }, 447 { "_Z3maxii", (void *)&SC_max_i32, true }, 448 { "_Z3maxss", (void *)&SC_max_i16, true }, 449 { "_Z3maxcc", (void *)&SC_max_i8, true }, 450 { "_Z3minjj", (void *)&SC_min_u32, true }, 451 { "_Z3mintt", (void *)&SC_min_u16, true }, 452 { "_Z3minhh", (void *)&SC_min_u8, true }, 453 { "_Z3minii", (void *)&SC_min_i32, true }, 454 { "_Z3minss", (void *)&SC_min_i16, true }, 455 { "_Z3mincc", (void *)&SC_min_i8, true }, 456 457 { "_Z5clampfff", (void *)&SC_clamp_f32, true }, 458 { "_Z3maxff", (void *)&SC_max_f32, true }, 459 { "_Z3minff", (void *)&SC_min_f32, true }, 460 { "_Z4stepff", (void *)&SC_step_f32, true }, 461 //{ "smoothstep", (void *)&, true }, 462 { "_Z4signf", (void *)&SC_sign_f32, true }, 463 464 // matrix 465 { "_Z20rsMatrixLoadIdentityP12rs_matrix4x4", (void *)&SC_MatrixLoadIdentity_4x4, true }, 466 { "_Z20rsMatrixLoadIdentityP12rs_matrix3x3", (void *)&SC_MatrixLoadIdentity_3x3, true }, 467 { "_Z20rsMatrixLoadIdentityP12rs_matrix2x2", (void *)&SC_MatrixLoadIdentity_2x2, true }, 468 469 { "_Z12rsMatrixLoadP12rs_matrix4x4PKf", (void *)&SC_MatrixLoad_4x4_f, true }, 470 { "_Z12rsMatrixLoadP12rs_matrix3x3PKf", (void *)&SC_MatrixLoad_3x3_f, true }, 471 { "_Z12rsMatrixLoadP12rs_matrix2x2PKf", (void *)&SC_MatrixLoad_2x2_f, true }, 472 473 { "_Z12rsMatrixLoadP12rs_matrix4x4PKS_", (void *)&SC_MatrixLoad_4x4_4x4, true }, 474 { "_Z12rsMatrixLoadP12rs_matrix4x4PK12rs_matrix3x3", (void *)&SC_MatrixLoad_4x4_3x3, true }, 475 { "_Z12rsMatrixLoadP12rs_matrix4x4PK12rs_matrix2x2", (void *)&SC_MatrixLoad_4x4_2x2, true }, 476 { "_Z12rsMatrixLoadP12rs_matrix3x3PKS_", (void *)&SC_MatrixLoad_3x3_3x3, true }, 477 { "_Z12rsMatrixLoadP12rs_matrix2x2PKS_", (void *)&SC_MatrixLoad_2x2_2x2, true }, 478 479 { "_Z18rsMatrixLoadRotateP12rs_matrix4x4ffff", (void *)&SC_MatrixLoadRotate, true }, 480 { "_Z17rsMatrixLoadScaleP12rs_matrix4x4fff", (void *)&SC_MatrixLoadScale, true }, 481 { "_Z21rsMatrixLoadTranslateP12rs_matrix4x4fff", (void *)&SC_MatrixLoadTranslate, true }, 482 { "_Z14rsMatrixRotateP12rs_matrix4x4ffff", (void *)&SC_MatrixRotate, true }, 483 { "_Z13rsMatrixScaleP12rs_matrix4x4fff", (void *)&SC_MatrixScale, true }, 484 { "_Z17rsMatrixTranslateP12rs_matrix4x4fff", (void *)&SC_MatrixTranslate, true }, 485 486 { "_Z20rsMatrixLoadMultiplyP12rs_matrix4x4PKS_S2_", (void *)&SC_MatrixLoadMultiply_4x4_4x4_4x4, true }, 487 { "_Z16rsMatrixMultiplyP12rs_matrix4x4PKS_", (void *)&SC_MatrixMultiply_4x4_4x4, true }, 488 { "_Z20rsMatrixLoadMultiplyP12rs_matrix3x3PKS_S2_", (void *)&SC_MatrixLoadMultiply_3x3_3x3_3x3, true }, 489 { "_Z16rsMatrixMultiplyP12rs_matrix3x3PKS_", (void *)&SC_MatrixMultiply_3x3_3x3, true }, 490 { "_Z20rsMatrixLoadMultiplyP12rs_matrix2x2PKS_S2_", (void *)&SC_MatrixLoadMultiply_2x2_2x2_2x2, true }, 491 { "_Z16rsMatrixMultiplyP12rs_matrix2x2PKS_", (void *)&SC_MatrixMultiply_2x2_2x2, true }, 492 493 { "_Z17rsMatrixLoadOrthoP12rs_matrix4x4ffffff", (void *)&SC_MatrixLoadOrtho, true }, 494 { "_Z19rsMatrixLoadFrustumP12rs_matrix4x4ffffff", (void *)&SC_MatrixLoadFrustum, true }, 495 { "_Z23rsMatrixLoadPerspectiveP12rs_matrix4x4ffff", (void *)&SC_MatrixLoadPerspective, true }, 496 497 { "_Z15rsMatrixInverseP12rs_matrix4x4", (void *)&SC_MatrixInverse_4x4, true }, 498 { "_Z24rsMatrixInverseTransposeP12rs_matrix4x4", (void *)&SC_MatrixInverseTranspose_4x4, true }, 499 { "_Z17rsMatrixTransposeP12rs_matrix4x4", (void *)&SC_MatrixTranspose_4x4, true }, 500 { "_Z17rsMatrixTransposeP12rs_matrix3x3", (void *)&SC_MatrixTranspose_3x3, true }, 501 { "_Z17rsMatrixTransposeP12rs_matrix2x2", (void *)&SC_MatrixTranspose_2x2, true }, 502 503 // RS Math 504 { "_Z6rsRandi", (void *)&SC_randi, true }, 505 { "_Z6rsRandii", (void *)&SC_randi2, true }, 506 { "_Z6rsRandf", (void *)&SC_randf, true }, 507 { "_Z6rsRandff", (void *)&SC_randf2, true }, 508 { "_Z6rsFracf", (void *)&SC_frac, true }, 509 510 // Atomics 511 { "_Z11rsAtomicIncPVi", (void *)&SC_AtomicInc, true }, 512 { "_Z11rsAtomicIncPVj", (void *)&SC_AtomicInc, true }, 513 { "_Z11rsAtomicDecPVi", (void *)&SC_AtomicDec, true }, 514 { "_Z11rsAtomicDecPVj", (void *)&SC_AtomicDec, true }, 515 { "_Z11rsAtomicAddPVii", (void *)&SC_AtomicAdd, true }, 516 { "_Z11rsAtomicAddPVjj", (void *)&SC_AtomicAdd, true }, 517 { "_Z11rsAtomicSubPVii", (void *)&SC_AtomicSub, true }, 518 { "_Z11rsAtomicSubPVjj", (void *)&SC_AtomicSub, true }, 519 { "_Z11rsAtomicAndPVii", (void *)&SC_AtomicAnd, true }, 520 { "_Z11rsAtomicAndPVjj", (void *)&SC_AtomicAnd, true }, 521 { "_Z10rsAtomicOrPVii", (void *)&SC_AtomicOr, true }, 522 { "_Z10rsAtomicOrPVjj", (void *)&SC_AtomicOr, true }, 523 { "_Z11rsAtomicXorPVii", (void *)&SC_AtomicXor, true }, 524 { "_Z11rsAtomicXorPVjj", (void *)&SC_AtomicXor, true }, 525 { "_Z11rsAtomicMinPVii", (void *)&SC_AtomicMin, true }, 526 { "_Z11rsAtomicMinPVjj", (void *)&SC_AtomicUMin, true }, 527 { "_Z11rsAtomicMaxPVii", (void *)&SC_AtomicMax, true }, 528 { "_Z11rsAtomicMaxPVjj", (void *)&SC_AtomicUMax, true }, 529 { "_Z11rsAtomicCasPViii", (void *)&SC_AtomicCas, true }, 530 { "_Z11rsAtomicCasPVjjj", (void *)&SC_AtomicCas, true }, 531 532 { NULL, NULL, false } 533}; 534 535const RsdSymbolTable * rsdLookupSymbolMath(const char *sym) { 536 const RsdSymbolTable *syms = gSyms; 537 538 while (syms->mPtr) { 539 if (!strcmp(syms->mName, sym)) { 540 return syms; 541 } 542 syms++; 543 } 544 return NULL; 545} 546 547