Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 1 | /* |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 2 | * Copyright (C) 2015 The Android Open Source Project |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -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 | |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 17 | // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 18 | |
| 19 | /* |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 20 | * rs_math.rsh: Mathematical Constants and Functions |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 21 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 22 | * The mathematical functions below can be applied to scalars and vectors. When applied |
| 23 | * to vectors, the returned value is a vector of the function applied to each entry of the input. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 24 | * |
| 25 | * For example: |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 26 | * float3 a, b; |
| 27 | * // The following call sets |
| 28 | * // a.x to sin(b.x), |
| 29 | * // a.y to sin(b.y), and |
| 30 | * // a.z to sin(b.z). |
| 31 | * a = sin(b); |
| 32 | * |
| 33 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 34 | * See Vector Math Functions for functions like distance() and length() that interpret |
| 35 | * instead the input as a single vector in n-dimensional space. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 36 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 37 | * The precision of the mathematical operations on 32 bit floats is affected by the pragmas |
| 38 | * rs_fp_relaxed and rs_fp_full. Under rs_fp_relaxed, subnormal values may be flushed to zero and |
| 39 | * rounding may be done towards zero. In comparison, rs_fp_full requires correct handling of |
| 40 | * subnormal values, i.e. smaller than 1.17549435e-38f. rs_fp_rull also requires round to nearest |
| 41 | * with ties to even. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 42 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 43 | * Different precision/speed tradeoffs can be achieved by using variants of the common math |
| 44 | * functions. Functions with a name starting with |
| 45 | * - native_: May have custom hardware implementations with weaker precision. Additionally, |
| 46 | * subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and |
| 47 | * infinity input may not be handled correctly. |
| 48 | * - half_: May perform internal computations using 16 bit floats. Additionally, subnormal |
| 49 | * values may be flushed to zero, and rounding towards zero may be used. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 50 | * |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 51 | */ |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 52 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 53 | #ifndef RENDERSCRIPT_RS_MATH_RSH |
| 54 | #define RENDERSCRIPT_RS_MATH_RSH |
| 55 | |
| 56 | /* |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 57 | * M_1_PI: 1 / pi, as a 32 bit float |
| 58 | * |
| 59 | * The inverse of pi, as a 32 bit float. |
| 60 | */ |
| 61 | #define M_1_PI 0.318309886183790671537767526745028724f |
| 62 | |
| 63 | /* |
| 64 | * M_2_PI: 2 / pi, as a 32 bit float |
| 65 | * |
| 66 | * 2 divided by pi, as a 32 bit float. |
| 67 | */ |
| 68 | #define M_2_PI 0.636619772367581343075535053490057448f |
| 69 | |
| 70 | /* |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 71 | * M_2_PIl: 2 / pi, as a 32 bit float |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 72 | * |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 73 | * DEPRECATED. Do not use. |
| 74 | * |
| 75 | * 2 divided by pi, as a 32 bit float. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 76 | */ |
| 77 | #define M_2_PIl 0.636619772367581343075535053490057448f |
| 78 | |
| 79 | /* |
| 80 | * M_2_SQRTPI: 2 / sqrt(pi), as a 32 bit float |
| 81 | * |
| 82 | * 2 divided by the square root of pi, as a 32 bit float. |
| 83 | */ |
| 84 | #define M_2_SQRTPI 1.128379167095512573896158903121545172f |
| 85 | |
| 86 | /* |
| 87 | * M_E: e, as a 32 bit float |
| 88 | * |
| 89 | * The number e, the base of the natural logarithm, as a 32 bit float. |
| 90 | */ |
| 91 | #define M_E 2.718281828459045235360287471352662498f |
| 92 | |
| 93 | /* |
| 94 | * M_LN10: log_e(10), as a 32 bit float |
| 95 | * |
| 96 | * The natural logarithm of 10, as a 32 bit float. |
| 97 | */ |
| 98 | #define M_LN10 2.302585092994045684017991454684364208f |
| 99 | |
| 100 | /* |
| 101 | * M_LN2: log_e(2), as a 32 bit float |
| 102 | * |
| 103 | * The natural logarithm of 2, as a 32 bit float. |
| 104 | */ |
| 105 | #define M_LN2 0.693147180559945309417232121458176568f |
| 106 | |
| 107 | /* |
| 108 | * M_LOG10E: log_10(e), as a 32 bit float |
| 109 | * |
| 110 | * The logarithm base 10 of e, as a 32 bit float. |
| 111 | */ |
| 112 | #define M_LOG10E 0.434294481903251827651128918916605082f |
| 113 | |
| 114 | /* |
| 115 | * M_LOG2E: log_2(e), as a 32 bit float |
| 116 | * |
| 117 | * The logarithm base 2 of e, as a 32 bit float. |
| 118 | */ |
| 119 | #define M_LOG2E 1.442695040888963407359924681001892137f |
| 120 | |
| 121 | /* |
| 122 | * M_PI: pi, as a 32 bit float |
| 123 | * |
| 124 | * The constant pi, as a 32 bit float. |
| 125 | */ |
| 126 | #define M_PI 3.141592653589793238462643383279502884f |
| 127 | |
| 128 | /* |
| 129 | * M_PI_2: pi / 2, as a 32 bit float |
| 130 | * |
| 131 | * Pi divided by 2, as a 32 bit float. |
| 132 | */ |
| 133 | #define M_PI_2 1.570796326794896619231321691639751442f |
| 134 | |
| 135 | /* |
| 136 | * M_PI_4: pi / 4, as a 32 bit float |
| 137 | * |
| 138 | * Pi divided by 4, as a 32 bit float. |
| 139 | */ |
| 140 | #define M_PI_4 0.785398163397448309615660845819875721f |
| 141 | |
| 142 | /* |
| 143 | * M_SQRT1_2: 1 / sqrt(2), as a 32 bit float |
| 144 | * |
| 145 | * The inverse of the square root of 2, as a 32 bit float. |
| 146 | */ |
| 147 | #define M_SQRT1_2 0.707106781186547524400844362104849039f |
| 148 | |
| 149 | /* |
| 150 | * M_SQRT2: sqrt(2), as a 32 bit float |
| 151 | * |
| 152 | * The square root of 2, as a 32 bit float. |
| 153 | */ |
| 154 | #define M_SQRT2 1.414213562373095048801688724209698079f |
| 155 | |
| 156 | /* |
| 157 | * abs: Absolute value of an integer |
| 158 | * |
| 159 | * Returns the absolute value of an integer. |
| 160 | * |
| 161 | * For floats, use fabs(). |
| 162 | */ |
| 163 | extern uchar __attribute__((const, overloadable)) |
| 164 | abs(char v); |
| 165 | |
| 166 | extern uchar2 __attribute__((const, overloadable)) |
| 167 | abs(char2 v); |
| 168 | |
| 169 | extern uchar3 __attribute__((const, overloadable)) |
| 170 | abs(char3 v); |
| 171 | |
| 172 | extern uchar4 __attribute__((const, overloadable)) |
| 173 | abs(char4 v); |
| 174 | |
| 175 | extern ushort __attribute__((const, overloadable)) |
| 176 | abs(short v); |
| 177 | |
| 178 | extern ushort2 __attribute__((const, overloadable)) |
| 179 | abs(short2 v); |
| 180 | |
| 181 | extern ushort3 __attribute__((const, overloadable)) |
| 182 | abs(short3 v); |
| 183 | |
| 184 | extern ushort4 __attribute__((const, overloadable)) |
| 185 | abs(short4 v); |
| 186 | |
| 187 | extern uint __attribute__((const, overloadable)) |
| 188 | abs(int v); |
| 189 | |
| 190 | extern uint2 __attribute__((const, overloadable)) |
| 191 | abs(int2 v); |
| 192 | |
| 193 | extern uint3 __attribute__((const, overloadable)) |
| 194 | abs(int3 v); |
| 195 | |
| 196 | extern uint4 __attribute__((const, overloadable)) |
| 197 | abs(int4 v); |
| 198 | |
| 199 | /* |
| 200 | * acos: Inverse cosine |
| 201 | * |
| 202 | * Returns the inverse cosine, in radians. |
| 203 | * |
| 204 | * See also native_acos(). |
| 205 | */ |
| 206 | extern float __attribute__((const, overloadable)) |
| 207 | acos(float v); |
| 208 | |
| 209 | extern float2 __attribute__((const, overloadable)) |
| 210 | acos(float2 v); |
| 211 | |
| 212 | extern float3 __attribute__((const, overloadable)) |
| 213 | acos(float3 v); |
| 214 | |
| 215 | extern float4 __attribute__((const, overloadable)) |
| 216 | acos(float4 v); |
| 217 | |
| 218 | /* |
| 219 | * acosh: Inverse hyperbolic cosine |
| 220 | * |
| 221 | * Returns the inverse hyperbolic cosine, in radians. |
| 222 | * |
| 223 | * See also native_acosh(). |
| 224 | */ |
| 225 | extern float __attribute__((const, overloadable)) |
| 226 | acosh(float v); |
| 227 | |
| 228 | extern float2 __attribute__((const, overloadable)) |
| 229 | acosh(float2 v); |
| 230 | |
| 231 | extern float3 __attribute__((const, overloadable)) |
| 232 | acosh(float3 v); |
| 233 | |
| 234 | extern float4 __attribute__((const, overloadable)) |
| 235 | acosh(float4 v); |
| 236 | |
| 237 | /* |
| 238 | * acospi: Inverse cosine divided by pi |
| 239 | * |
| 240 | * Returns the inverse cosine in radians, divided by pi. |
| 241 | * |
| 242 | * To get an inverse cosine measured in degrees, use acospi(a) * 180.f. |
| 243 | * |
| 244 | * See also native_acospi(). |
| 245 | */ |
| 246 | extern float __attribute__((const, overloadable)) |
| 247 | acospi(float v); |
| 248 | |
| 249 | extern float2 __attribute__((const, overloadable)) |
| 250 | acospi(float2 v); |
| 251 | |
| 252 | extern float3 __attribute__((const, overloadable)) |
| 253 | acospi(float3 v); |
| 254 | |
| 255 | extern float4 __attribute__((const, overloadable)) |
| 256 | acospi(float4 v); |
| 257 | |
| 258 | /* |
| 259 | * asin: Inverse sine |
| 260 | * |
| 261 | * Returns the inverse sine, in radians. |
| 262 | * |
| 263 | * See also native_asin(). |
| 264 | */ |
| 265 | extern float __attribute__((const, overloadable)) |
| 266 | asin(float v); |
| 267 | |
| 268 | extern float2 __attribute__((const, overloadable)) |
| 269 | asin(float2 v); |
| 270 | |
| 271 | extern float3 __attribute__((const, overloadable)) |
| 272 | asin(float3 v); |
| 273 | |
| 274 | extern float4 __attribute__((const, overloadable)) |
| 275 | asin(float4 v); |
| 276 | |
| 277 | /* |
| 278 | * asinh: Inverse hyperbolic sine |
| 279 | * |
| 280 | * Returns the inverse hyperbolic sine, in radians. |
| 281 | * |
| 282 | * See also native_asinh(). |
| 283 | */ |
| 284 | extern float __attribute__((const, overloadable)) |
| 285 | asinh(float v); |
| 286 | |
| 287 | extern float2 __attribute__((const, overloadable)) |
| 288 | asinh(float2 v); |
| 289 | |
| 290 | extern float3 __attribute__((const, overloadable)) |
| 291 | asinh(float3 v); |
| 292 | |
| 293 | extern float4 __attribute__((const, overloadable)) |
| 294 | asinh(float4 v); |
| 295 | |
| 296 | /* |
| 297 | * asinpi: Inverse sine divided by pi |
| 298 | * |
| 299 | * Returns the inverse sine in radians, divided by pi. |
| 300 | * |
| 301 | * To get an inverse sine measured in degrees, use asinpi(a) * 180.f. |
| 302 | * |
| 303 | * See also native_asinpi(). |
| 304 | */ |
| 305 | extern float __attribute__((const, overloadable)) |
| 306 | asinpi(float v); |
| 307 | |
| 308 | extern float2 __attribute__((const, overloadable)) |
| 309 | asinpi(float2 v); |
| 310 | |
| 311 | extern float3 __attribute__((const, overloadable)) |
| 312 | asinpi(float3 v); |
| 313 | |
| 314 | extern float4 __attribute__((const, overloadable)) |
| 315 | asinpi(float4 v); |
| 316 | |
| 317 | /* |
| 318 | * atan: Inverse tangent |
| 319 | * |
| 320 | * Returns the inverse tangent, in radians. |
| 321 | * |
| 322 | * See also native_atan(). |
| 323 | */ |
| 324 | extern float __attribute__((const, overloadable)) |
| 325 | atan(float v); |
| 326 | |
| 327 | extern float2 __attribute__((const, overloadable)) |
| 328 | atan(float2 v); |
| 329 | |
| 330 | extern float3 __attribute__((const, overloadable)) |
| 331 | atan(float3 v); |
| 332 | |
| 333 | extern float4 __attribute__((const, overloadable)) |
| 334 | atan(float4 v); |
| 335 | |
| 336 | /* |
| 337 | * atan2: Inverse tangent of a ratio |
| 338 | * |
| 339 | * Returns the inverse tangent of (numerator / denominator), in radians. |
| 340 | * |
| 341 | * See also native_atan2(). |
| 342 | * |
| 343 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 344 | * numerator: Numerator. |
| 345 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 346 | */ |
| 347 | extern float __attribute__((const, overloadable)) |
| 348 | atan2(float numerator, float denominator); |
| 349 | |
| 350 | extern float2 __attribute__((const, overloadable)) |
| 351 | atan2(float2 numerator, float2 denominator); |
| 352 | |
| 353 | extern float3 __attribute__((const, overloadable)) |
| 354 | atan2(float3 numerator, float3 denominator); |
| 355 | |
| 356 | extern float4 __attribute__((const, overloadable)) |
| 357 | atan2(float4 numerator, float4 denominator); |
| 358 | |
| 359 | /* |
| 360 | * atan2pi: Inverse tangent of a ratio, divided by pi |
| 361 | * |
| 362 | * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi. |
| 363 | * |
| 364 | * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f. |
| 365 | * |
| 366 | * See also native_atan2pi(). |
| 367 | * |
| 368 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 369 | * numerator: Numerator. |
| 370 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 371 | */ |
| 372 | extern float __attribute__((const, overloadable)) |
| 373 | atan2pi(float numerator, float denominator); |
| 374 | |
| 375 | extern float2 __attribute__((const, overloadable)) |
| 376 | atan2pi(float2 numerator, float2 denominator); |
| 377 | |
| 378 | extern float3 __attribute__((const, overloadable)) |
| 379 | atan2pi(float3 numerator, float3 denominator); |
| 380 | |
| 381 | extern float4 __attribute__((const, overloadable)) |
| 382 | atan2pi(float4 numerator, float4 denominator); |
| 383 | |
| 384 | /* |
| 385 | * atanh: Inverse hyperbolic tangent |
| 386 | * |
| 387 | * Returns the inverse hyperbolic tangent, in radians. |
| 388 | * |
| 389 | * See also native_atanh(). |
| 390 | */ |
| 391 | extern float __attribute__((const, overloadable)) |
| 392 | atanh(float v); |
| 393 | |
| 394 | extern float2 __attribute__((const, overloadable)) |
| 395 | atanh(float2 v); |
| 396 | |
| 397 | extern float3 __attribute__((const, overloadable)) |
| 398 | atanh(float3 v); |
| 399 | |
| 400 | extern float4 __attribute__((const, overloadable)) |
| 401 | atanh(float4 v); |
| 402 | |
| 403 | /* |
| 404 | * atanpi: Inverse tangent divided by pi |
| 405 | * |
| 406 | * Returns the inverse tangent in radians, divided by pi. |
| 407 | * |
| 408 | * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f. |
| 409 | * |
| 410 | * See also native_atanpi(). |
| 411 | */ |
| 412 | extern float __attribute__((const, overloadable)) |
| 413 | atanpi(float v); |
| 414 | |
| 415 | extern float2 __attribute__((const, overloadable)) |
| 416 | atanpi(float2 v); |
| 417 | |
| 418 | extern float3 __attribute__((const, overloadable)) |
| 419 | atanpi(float3 v); |
| 420 | |
| 421 | extern float4 __attribute__((const, overloadable)) |
| 422 | atanpi(float4 v); |
| 423 | |
| 424 | /* |
| 425 | * cbrt: Cube root |
| 426 | * |
| 427 | * Returns the cube root. |
| 428 | * |
| 429 | * See also native_cbrt(). |
| 430 | */ |
| 431 | extern float __attribute__((const, overloadable)) |
| 432 | cbrt(float v); |
| 433 | |
| 434 | extern float2 __attribute__((const, overloadable)) |
| 435 | cbrt(float2 v); |
| 436 | |
| 437 | extern float3 __attribute__((const, overloadable)) |
| 438 | cbrt(float3 v); |
| 439 | |
| 440 | extern float4 __attribute__((const, overloadable)) |
| 441 | cbrt(float4 v); |
| 442 | |
| 443 | /* |
| 444 | * ceil: Smallest integer not less than a value |
| 445 | * |
| 446 | * Returns the smallest integer not less than a value. |
| 447 | * |
| 448 | * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f. |
| 449 | * |
| 450 | * See also floor(). |
| 451 | */ |
| 452 | extern float __attribute__((const, overloadable)) |
| 453 | ceil(float v); |
| 454 | |
| 455 | extern float2 __attribute__((const, overloadable)) |
| 456 | ceil(float2 v); |
| 457 | |
| 458 | extern float3 __attribute__((const, overloadable)) |
| 459 | ceil(float3 v); |
| 460 | |
| 461 | extern float4 __attribute__((const, overloadable)) |
| 462 | ceil(float4 v); |
| 463 | |
| 464 | /* |
| 465 | * clamp: Restrain a value to a range |
| 466 | * |
| 467 | * Clamps a value to a specified high and low bound. clamp() returns min_value |
| 468 | * if value < min_value, max_value if value > max_value, otherwise value. |
| 469 | * |
| 470 | * There are two variants of clamp: one where the min and max are scalars applied |
| 471 | * to all entries of the value, the other where the min and max are also vectors. |
| 472 | * |
| 473 | * If min_value is greater than max_value, the results are undefined. |
| 474 | * |
| 475 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 476 | * value: Value to be clamped. |
| 477 | * min_value: Lower bound, a scalar or matching vector. |
| 478 | * max_value: High bound, must match the type of low. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 479 | */ |
| 480 | extern float __attribute__((const, overloadable)) |
| 481 | clamp(float value, float min_value, float max_value); |
| 482 | |
| 483 | extern float2 __attribute__((const, overloadable)) |
| 484 | clamp(float2 value, float2 min_value, float2 max_value); |
| 485 | |
| 486 | extern float3 __attribute__((const, overloadable)) |
| 487 | clamp(float3 value, float3 min_value, float3 max_value); |
| 488 | |
| 489 | extern float4 __attribute__((const, overloadable)) |
| 490 | clamp(float4 value, float4 min_value, float4 max_value); |
| 491 | |
| 492 | extern float2 __attribute__((const, overloadable)) |
| 493 | clamp(float2 value, float min_value, float max_value); |
| 494 | |
| 495 | extern float3 __attribute__((const, overloadable)) |
| 496 | clamp(float3 value, float min_value, float max_value); |
| 497 | |
| 498 | extern float4 __attribute__((const, overloadable)) |
| 499 | clamp(float4 value, float min_value, float max_value); |
| 500 | |
| 501 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 502 | extern char __attribute__((const, overloadable)) |
| 503 | clamp(char value, char min_value, char max_value); |
| 504 | #endif |
| 505 | |
| 506 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 507 | extern char2 __attribute__((const, overloadable)) |
| 508 | clamp(char2 value, char2 min_value, char2 max_value); |
| 509 | #endif |
| 510 | |
| 511 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 512 | extern char3 __attribute__((const, overloadable)) |
| 513 | clamp(char3 value, char3 min_value, char3 max_value); |
| 514 | #endif |
| 515 | |
| 516 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 517 | extern char4 __attribute__((const, overloadable)) |
| 518 | clamp(char4 value, char4 min_value, char4 max_value); |
| 519 | #endif |
| 520 | |
| 521 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 522 | extern uchar __attribute__((const, overloadable)) |
| 523 | clamp(uchar value, uchar min_value, uchar max_value); |
| 524 | #endif |
| 525 | |
| 526 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 527 | extern uchar2 __attribute__((const, overloadable)) |
| 528 | clamp(uchar2 value, uchar2 min_value, uchar2 max_value); |
| 529 | #endif |
| 530 | |
| 531 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 532 | extern uchar3 __attribute__((const, overloadable)) |
| 533 | clamp(uchar3 value, uchar3 min_value, uchar3 max_value); |
| 534 | #endif |
| 535 | |
| 536 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 537 | extern uchar4 __attribute__((const, overloadable)) |
| 538 | clamp(uchar4 value, uchar4 min_value, uchar4 max_value); |
| 539 | #endif |
| 540 | |
| 541 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 542 | extern short __attribute__((const, overloadable)) |
| 543 | clamp(short value, short min_value, short max_value); |
| 544 | #endif |
| 545 | |
| 546 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 547 | extern short2 __attribute__((const, overloadable)) |
| 548 | clamp(short2 value, short2 min_value, short2 max_value); |
| 549 | #endif |
| 550 | |
| 551 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 552 | extern short3 __attribute__((const, overloadable)) |
| 553 | clamp(short3 value, short3 min_value, short3 max_value); |
| 554 | #endif |
| 555 | |
| 556 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 557 | extern short4 __attribute__((const, overloadable)) |
| 558 | clamp(short4 value, short4 min_value, short4 max_value); |
| 559 | #endif |
| 560 | |
| 561 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 562 | extern ushort __attribute__((const, overloadable)) |
| 563 | clamp(ushort value, ushort min_value, ushort max_value); |
| 564 | #endif |
| 565 | |
| 566 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 567 | extern ushort2 __attribute__((const, overloadable)) |
| 568 | clamp(ushort2 value, ushort2 min_value, ushort2 max_value); |
| 569 | #endif |
| 570 | |
| 571 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 572 | extern ushort3 __attribute__((const, overloadable)) |
| 573 | clamp(ushort3 value, ushort3 min_value, ushort3 max_value); |
| 574 | #endif |
| 575 | |
| 576 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 577 | extern ushort4 __attribute__((const, overloadable)) |
| 578 | clamp(ushort4 value, ushort4 min_value, ushort4 max_value); |
| 579 | #endif |
| 580 | |
| 581 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 582 | extern int __attribute__((const, overloadable)) |
| 583 | clamp(int value, int min_value, int max_value); |
| 584 | #endif |
| 585 | |
| 586 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 587 | extern int2 __attribute__((const, overloadable)) |
| 588 | clamp(int2 value, int2 min_value, int2 max_value); |
| 589 | #endif |
| 590 | |
| 591 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 592 | extern int3 __attribute__((const, overloadable)) |
| 593 | clamp(int3 value, int3 min_value, int3 max_value); |
| 594 | #endif |
| 595 | |
| 596 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 597 | extern int4 __attribute__((const, overloadable)) |
| 598 | clamp(int4 value, int4 min_value, int4 max_value); |
| 599 | #endif |
| 600 | |
| 601 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 602 | extern uint __attribute__((const, overloadable)) |
| 603 | clamp(uint value, uint min_value, uint max_value); |
| 604 | #endif |
| 605 | |
| 606 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 607 | extern uint2 __attribute__((const, overloadable)) |
| 608 | clamp(uint2 value, uint2 min_value, uint2 max_value); |
| 609 | #endif |
| 610 | |
| 611 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 612 | extern uint3 __attribute__((const, overloadable)) |
| 613 | clamp(uint3 value, uint3 min_value, uint3 max_value); |
| 614 | #endif |
| 615 | |
| 616 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 617 | extern uint4 __attribute__((const, overloadable)) |
| 618 | clamp(uint4 value, uint4 min_value, uint4 max_value); |
| 619 | #endif |
| 620 | |
| 621 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 622 | extern long __attribute__((const, overloadable)) |
| 623 | clamp(long value, long min_value, long max_value); |
| 624 | #endif |
| 625 | |
| 626 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 627 | extern long2 __attribute__((const, overloadable)) |
| 628 | clamp(long2 value, long2 min_value, long2 max_value); |
| 629 | #endif |
| 630 | |
| 631 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 632 | extern long3 __attribute__((const, overloadable)) |
| 633 | clamp(long3 value, long3 min_value, long3 max_value); |
| 634 | #endif |
| 635 | |
| 636 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 637 | extern long4 __attribute__((const, overloadable)) |
| 638 | clamp(long4 value, long4 min_value, long4 max_value); |
| 639 | #endif |
| 640 | |
| 641 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 642 | extern ulong __attribute__((const, overloadable)) |
| 643 | clamp(ulong value, ulong min_value, ulong max_value); |
| 644 | #endif |
| 645 | |
| 646 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 647 | extern ulong2 __attribute__((const, overloadable)) |
| 648 | clamp(ulong2 value, ulong2 min_value, ulong2 max_value); |
| 649 | #endif |
| 650 | |
| 651 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 652 | extern ulong3 __attribute__((const, overloadable)) |
| 653 | clamp(ulong3 value, ulong3 min_value, ulong3 max_value); |
| 654 | #endif |
| 655 | |
| 656 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 657 | extern ulong4 __attribute__((const, overloadable)) |
| 658 | clamp(ulong4 value, ulong4 min_value, ulong4 max_value); |
| 659 | #endif |
| 660 | |
| 661 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 662 | extern char2 __attribute__((const, overloadable)) |
| 663 | clamp(char2 value, char min_value, char max_value); |
| 664 | #endif |
| 665 | |
| 666 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 667 | extern char3 __attribute__((const, overloadable)) |
| 668 | clamp(char3 value, char min_value, char max_value); |
| 669 | #endif |
| 670 | |
| 671 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 672 | extern char4 __attribute__((const, overloadable)) |
| 673 | clamp(char4 value, char min_value, char max_value); |
| 674 | #endif |
| 675 | |
| 676 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 677 | extern uchar2 __attribute__((const, overloadable)) |
| 678 | clamp(uchar2 value, uchar min_value, uchar max_value); |
| 679 | #endif |
| 680 | |
| 681 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 682 | extern uchar3 __attribute__((const, overloadable)) |
| 683 | clamp(uchar3 value, uchar min_value, uchar max_value); |
| 684 | #endif |
| 685 | |
| 686 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 687 | extern uchar4 __attribute__((const, overloadable)) |
| 688 | clamp(uchar4 value, uchar min_value, uchar max_value); |
| 689 | #endif |
| 690 | |
| 691 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 692 | extern short2 __attribute__((const, overloadable)) |
| 693 | clamp(short2 value, short min_value, short max_value); |
| 694 | #endif |
| 695 | |
| 696 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 697 | extern short3 __attribute__((const, overloadable)) |
| 698 | clamp(short3 value, short min_value, short max_value); |
| 699 | #endif |
| 700 | |
| 701 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 702 | extern short4 __attribute__((const, overloadable)) |
| 703 | clamp(short4 value, short min_value, short max_value); |
| 704 | #endif |
| 705 | |
| 706 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 707 | extern ushort2 __attribute__((const, overloadable)) |
| 708 | clamp(ushort2 value, ushort min_value, ushort max_value); |
| 709 | #endif |
| 710 | |
| 711 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 712 | extern ushort3 __attribute__((const, overloadable)) |
| 713 | clamp(ushort3 value, ushort min_value, ushort max_value); |
| 714 | #endif |
| 715 | |
| 716 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 717 | extern ushort4 __attribute__((const, overloadable)) |
| 718 | clamp(ushort4 value, ushort min_value, ushort max_value); |
| 719 | #endif |
| 720 | |
| 721 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 722 | extern int2 __attribute__((const, overloadable)) |
| 723 | clamp(int2 value, int min_value, int max_value); |
| 724 | #endif |
| 725 | |
| 726 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 727 | extern int3 __attribute__((const, overloadable)) |
| 728 | clamp(int3 value, int min_value, int max_value); |
| 729 | #endif |
| 730 | |
| 731 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 732 | extern int4 __attribute__((const, overloadable)) |
| 733 | clamp(int4 value, int min_value, int max_value); |
| 734 | #endif |
| 735 | |
| 736 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 737 | extern uint2 __attribute__((const, overloadable)) |
| 738 | clamp(uint2 value, uint min_value, uint max_value); |
| 739 | #endif |
| 740 | |
| 741 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 742 | extern uint3 __attribute__((const, overloadable)) |
| 743 | clamp(uint3 value, uint min_value, uint max_value); |
| 744 | #endif |
| 745 | |
| 746 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 747 | extern uint4 __attribute__((const, overloadable)) |
| 748 | clamp(uint4 value, uint min_value, uint max_value); |
| 749 | #endif |
| 750 | |
| 751 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 752 | extern long2 __attribute__((const, overloadable)) |
| 753 | clamp(long2 value, long min_value, long max_value); |
| 754 | #endif |
| 755 | |
| 756 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 757 | extern long3 __attribute__((const, overloadable)) |
| 758 | clamp(long3 value, long min_value, long max_value); |
| 759 | #endif |
| 760 | |
| 761 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 762 | extern long4 __attribute__((const, overloadable)) |
| 763 | clamp(long4 value, long min_value, long max_value); |
| 764 | #endif |
| 765 | |
| 766 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 767 | extern ulong2 __attribute__((const, overloadable)) |
| 768 | clamp(ulong2 value, ulong min_value, ulong max_value); |
| 769 | #endif |
| 770 | |
| 771 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 772 | extern ulong3 __attribute__((const, overloadable)) |
| 773 | clamp(ulong3 value, ulong min_value, ulong max_value); |
| 774 | #endif |
| 775 | |
| 776 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 777 | extern ulong4 __attribute__((const, overloadable)) |
| 778 | clamp(ulong4 value, ulong min_value, ulong max_value); |
| 779 | #endif |
| 780 | |
| 781 | /* |
| 782 | * clz: Number of leading 0 bits |
| 783 | * |
| 784 | * Returns the number of leading 0-bits in a value. |
| 785 | * |
| 786 | * For example, clz((char)0x03) returns 6. |
| 787 | */ |
| 788 | extern char __attribute__((const, overloadable)) |
| 789 | clz(char value); |
| 790 | |
| 791 | extern char2 __attribute__((const, overloadable)) |
| 792 | clz(char2 value); |
| 793 | |
| 794 | extern char3 __attribute__((const, overloadable)) |
| 795 | clz(char3 value); |
| 796 | |
| 797 | extern char4 __attribute__((const, overloadable)) |
| 798 | clz(char4 value); |
| 799 | |
| 800 | extern uchar __attribute__((const, overloadable)) |
| 801 | clz(uchar value); |
| 802 | |
| 803 | extern uchar2 __attribute__((const, overloadable)) |
| 804 | clz(uchar2 value); |
| 805 | |
| 806 | extern uchar3 __attribute__((const, overloadable)) |
| 807 | clz(uchar3 value); |
| 808 | |
| 809 | extern uchar4 __attribute__((const, overloadable)) |
| 810 | clz(uchar4 value); |
| 811 | |
| 812 | extern short __attribute__((const, overloadable)) |
| 813 | clz(short value); |
| 814 | |
| 815 | extern short2 __attribute__((const, overloadable)) |
| 816 | clz(short2 value); |
| 817 | |
| 818 | extern short3 __attribute__((const, overloadable)) |
| 819 | clz(short3 value); |
| 820 | |
| 821 | extern short4 __attribute__((const, overloadable)) |
| 822 | clz(short4 value); |
| 823 | |
| 824 | extern ushort __attribute__((const, overloadable)) |
| 825 | clz(ushort value); |
| 826 | |
| 827 | extern ushort2 __attribute__((const, overloadable)) |
| 828 | clz(ushort2 value); |
| 829 | |
| 830 | extern ushort3 __attribute__((const, overloadable)) |
| 831 | clz(ushort3 value); |
| 832 | |
| 833 | extern ushort4 __attribute__((const, overloadable)) |
| 834 | clz(ushort4 value); |
| 835 | |
| 836 | extern int __attribute__((const, overloadable)) |
| 837 | clz(int value); |
| 838 | |
| 839 | extern int2 __attribute__((const, overloadable)) |
| 840 | clz(int2 value); |
| 841 | |
| 842 | extern int3 __attribute__((const, overloadable)) |
| 843 | clz(int3 value); |
| 844 | |
| 845 | extern int4 __attribute__((const, overloadable)) |
| 846 | clz(int4 value); |
| 847 | |
| 848 | extern uint __attribute__((const, overloadable)) |
| 849 | clz(uint value); |
| 850 | |
| 851 | extern uint2 __attribute__((const, overloadable)) |
| 852 | clz(uint2 value); |
| 853 | |
| 854 | extern uint3 __attribute__((const, overloadable)) |
| 855 | clz(uint3 value); |
| 856 | |
| 857 | extern uint4 __attribute__((const, overloadable)) |
| 858 | clz(uint4 value); |
| 859 | |
| 860 | /* |
| 861 | * copysign: Copies the sign of a number to another |
| 862 | * |
| 863 | * Copies the sign from sign_value to magnitude_value. |
| 864 | * |
| 865 | * The value returned is either magnitude_value or -magnitude_value. |
| 866 | * |
| 867 | * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f. |
| 868 | */ |
| 869 | extern float __attribute__((const, overloadable)) |
| 870 | copysign(float magnitude_value, float sign_value); |
| 871 | |
| 872 | extern float2 __attribute__((const, overloadable)) |
| 873 | copysign(float2 magnitude_value, float2 sign_value); |
| 874 | |
| 875 | extern float3 __attribute__((const, overloadable)) |
| 876 | copysign(float3 magnitude_value, float3 sign_value); |
| 877 | |
| 878 | extern float4 __attribute__((const, overloadable)) |
| 879 | copysign(float4 magnitude_value, float4 sign_value); |
| 880 | |
| 881 | /* |
| 882 | * cos: Cosine |
| 883 | * |
| 884 | * Returns the cosine of an angle measured in radians. |
| 885 | * |
| 886 | * See also native_cos(). |
| 887 | */ |
| 888 | extern float __attribute__((const, overloadable)) |
| 889 | cos(float v); |
| 890 | |
| 891 | extern float2 __attribute__((const, overloadable)) |
| 892 | cos(float2 v); |
| 893 | |
| 894 | extern float3 __attribute__((const, overloadable)) |
| 895 | cos(float3 v); |
| 896 | |
| 897 | extern float4 __attribute__((const, overloadable)) |
| 898 | cos(float4 v); |
| 899 | |
| 900 | /* |
| 901 | * cosh: Hypebolic cosine |
| 902 | * |
| 903 | * Returns the hypebolic cosine of v, where v is measured in radians. |
| 904 | * |
| 905 | * See also native_cosh(). |
| 906 | */ |
| 907 | extern float __attribute__((const, overloadable)) |
| 908 | cosh(float v); |
| 909 | |
| 910 | extern float2 __attribute__((const, overloadable)) |
| 911 | cosh(float2 v); |
| 912 | |
| 913 | extern float3 __attribute__((const, overloadable)) |
| 914 | cosh(float3 v); |
| 915 | |
| 916 | extern float4 __attribute__((const, overloadable)) |
| 917 | cosh(float4 v); |
| 918 | |
| 919 | /* |
| 920 | * cospi: Cosine of a number multiplied by pi |
| 921 | * |
| 922 | * Returns the cosine of (v * pi), where (v * pi) is measured in radians. |
| 923 | * |
| 924 | * To get the cosine of a value measured in degrees, call cospi(v / 180.f). |
| 925 | * |
| 926 | * See also native_cospi(). |
| 927 | */ |
| 928 | extern float __attribute__((const, overloadable)) |
| 929 | cospi(float v); |
| 930 | |
| 931 | extern float2 __attribute__((const, overloadable)) |
| 932 | cospi(float2 v); |
| 933 | |
| 934 | extern float3 __attribute__((const, overloadable)) |
| 935 | cospi(float3 v); |
| 936 | |
| 937 | extern float4 __attribute__((const, overloadable)) |
| 938 | cospi(float4 v); |
| 939 | |
| 940 | /* |
| 941 | * degrees: Converts radians into degrees |
| 942 | * |
| 943 | * Converts from radians to degrees. |
| 944 | */ |
| 945 | extern float __attribute__((const, overloadable)) |
| 946 | degrees(float v); |
| 947 | |
| 948 | extern float2 __attribute__((const, overloadable)) |
| 949 | degrees(float2 v); |
| 950 | |
| 951 | extern float3 __attribute__((const, overloadable)) |
| 952 | degrees(float3 v); |
| 953 | |
| 954 | extern float4 __attribute__((const, overloadable)) |
| 955 | degrees(float4 v); |
| 956 | |
| 957 | /* |
| 958 | * erf: Mathematical error function |
| 959 | * |
| 960 | * Returns the error function. |
| 961 | */ |
| 962 | extern float __attribute__((const, overloadable)) |
| 963 | erf(float v); |
| 964 | |
| 965 | extern float2 __attribute__((const, overloadable)) |
| 966 | erf(float2 v); |
| 967 | |
| 968 | extern float3 __attribute__((const, overloadable)) |
| 969 | erf(float3 v); |
| 970 | |
| 971 | extern float4 __attribute__((const, overloadable)) |
| 972 | erf(float4 v); |
| 973 | |
| 974 | /* |
| 975 | * erfc: Mathematical complementary error function |
| 976 | * |
| 977 | * Returns the complementary error function. |
| 978 | */ |
| 979 | extern float __attribute__((const, overloadable)) |
| 980 | erfc(float v); |
| 981 | |
| 982 | extern float2 __attribute__((const, overloadable)) |
| 983 | erfc(float2 v); |
| 984 | |
| 985 | extern float3 __attribute__((const, overloadable)) |
| 986 | erfc(float3 v); |
| 987 | |
| 988 | extern float4 __attribute__((const, overloadable)) |
| 989 | erfc(float4 v); |
| 990 | |
| 991 | /* |
| 992 | * exp: e raised to a number |
| 993 | * |
| 994 | * Returns e raised to v, i.e. e ^ v. |
| 995 | * |
| 996 | * See also native_exp(). |
| 997 | */ |
| 998 | extern float __attribute__((const, overloadable)) |
| 999 | exp(float v); |
| 1000 | |
| 1001 | extern float2 __attribute__((const, overloadable)) |
| 1002 | exp(float2 v); |
| 1003 | |
| 1004 | extern float3 __attribute__((const, overloadable)) |
| 1005 | exp(float3 v); |
| 1006 | |
| 1007 | extern float4 __attribute__((const, overloadable)) |
| 1008 | exp(float4 v); |
| 1009 | |
| 1010 | /* |
| 1011 | * exp10: 10 raised to a number |
| 1012 | * |
| 1013 | * Returns 10 raised to v, i.e. 10.f ^ v. |
| 1014 | * |
| 1015 | * See also native_exp10(). |
| 1016 | */ |
| 1017 | extern float __attribute__((const, overloadable)) |
| 1018 | exp10(float v); |
| 1019 | |
| 1020 | extern float2 __attribute__((const, overloadable)) |
| 1021 | exp10(float2 v); |
| 1022 | |
| 1023 | extern float3 __attribute__((const, overloadable)) |
| 1024 | exp10(float3 v); |
| 1025 | |
| 1026 | extern float4 __attribute__((const, overloadable)) |
| 1027 | exp10(float4 v); |
| 1028 | |
| 1029 | /* |
| 1030 | * exp2: 2 raised to a number |
| 1031 | * |
| 1032 | * Returns 2 raised to v, i.e. 2.f ^ v. |
| 1033 | * |
| 1034 | * See also native_exp2(). |
| 1035 | */ |
| 1036 | extern float __attribute__((const, overloadable)) |
| 1037 | exp2(float v); |
| 1038 | |
| 1039 | extern float2 __attribute__((const, overloadable)) |
| 1040 | exp2(float2 v); |
| 1041 | |
| 1042 | extern float3 __attribute__((const, overloadable)) |
| 1043 | exp2(float3 v); |
| 1044 | |
| 1045 | extern float4 __attribute__((const, overloadable)) |
| 1046 | exp2(float4 v); |
| 1047 | |
| 1048 | /* |
| 1049 | * expm1: e raised to a number minus one |
| 1050 | * |
| 1051 | * Returns e raised to v minus 1, i.e. (e ^ v) - 1. |
| 1052 | * |
| 1053 | * See also native_expm1(). |
| 1054 | */ |
| 1055 | extern float __attribute__((const, overloadable)) |
| 1056 | expm1(float v); |
| 1057 | |
| 1058 | extern float2 __attribute__((const, overloadable)) |
| 1059 | expm1(float2 v); |
| 1060 | |
| 1061 | extern float3 __attribute__((const, overloadable)) |
| 1062 | expm1(float3 v); |
| 1063 | |
| 1064 | extern float4 __attribute__((const, overloadable)) |
| 1065 | expm1(float4 v); |
| 1066 | |
| 1067 | /* |
| 1068 | * fabs: Absolute value of a float |
| 1069 | * |
| 1070 | * Returns the absolute value of the float v. |
| 1071 | * |
| 1072 | * For integers, use abs(). |
| 1073 | */ |
| 1074 | extern float __attribute__((const, overloadable)) |
| 1075 | fabs(float v); |
| 1076 | |
| 1077 | extern float2 __attribute__((const, overloadable)) |
| 1078 | fabs(float2 v); |
| 1079 | |
| 1080 | extern float3 __attribute__((const, overloadable)) |
| 1081 | fabs(float3 v); |
| 1082 | |
| 1083 | extern float4 __attribute__((const, overloadable)) |
| 1084 | fabs(float4 v); |
| 1085 | |
| 1086 | /* |
| 1087 | * fdim: Positive difference between two values |
| 1088 | * |
| 1089 | * Returns the positive difference between two values. |
| 1090 | * |
| 1091 | * If a > b, returns (a - b) otherwise returns 0f. |
| 1092 | */ |
| 1093 | extern float __attribute__((const, overloadable)) |
| 1094 | fdim(float a, float b); |
| 1095 | |
| 1096 | extern float2 __attribute__((const, overloadable)) |
| 1097 | fdim(float2 a, float2 b); |
| 1098 | |
| 1099 | extern float3 __attribute__((const, overloadable)) |
| 1100 | fdim(float3 a, float3 b); |
| 1101 | |
| 1102 | extern float4 __attribute__((const, overloadable)) |
| 1103 | fdim(float4 a, float4 b); |
| 1104 | |
| 1105 | /* |
| 1106 | * floor: Smallest integer not greater than a value |
| 1107 | * |
| 1108 | * Returns the smallest integer not greater than a value. |
| 1109 | * |
| 1110 | * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f. |
| 1111 | * |
| 1112 | * See also ceil(). |
| 1113 | */ |
| 1114 | extern float __attribute__((const, overloadable)) |
| 1115 | floor(float v); |
| 1116 | |
| 1117 | extern float2 __attribute__((const, overloadable)) |
| 1118 | floor(float2 v); |
| 1119 | |
| 1120 | extern float3 __attribute__((const, overloadable)) |
| 1121 | floor(float3 v); |
| 1122 | |
| 1123 | extern float4 __attribute__((const, overloadable)) |
| 1124 | floor(float4 v); |
| 1125 | |
| 1126 | /* |
| 1127 | * fma: Multiply and add |
| 1128 | * |
| 1129 | * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset. |
| 1130 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 1131 | * This function is similar to mad(). fma() retains full precision of the multiplied result |
| 1132 | * and rounds only after the addition. mad() rounds after the multiplication and the addition. |
| 1133 | * This extra precision is not guaranteed in rs_fp_relaxed mode. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1134 | */ |
| 1135 | extern float __attribute__((const, overloadable)) |
| 1136 | fma(float multiplicand1, float multiplicand2, float offset); |
| 1137 | |
| 1138 | extern float2 __attribute__((const, overloadable)) |
| 1139 | fma(float2 multiplicand1, float2 multiplicand2, float2 offset); |
| 1140 | |
| 1141 | extern float3 __attribute__((const, overloadable)) |
| 1142 | fma(float3 multiplicand1, float3 multiplicand2, float3 offset); |
| 1143 | |
| 1144 | extern float4 __attribute__((const, overloadable)) |
| 1145 | fma(float4 multiplicand1, float4 multiplicand2, float4 offset); |
| 1146 | |
| 1147 | /* |
| 1148 | * fmax: Maximum of two floats |
| 1149 | * |
| 1150 | * Returns the maximum of a and b, i.e. (a < b ? b : a). |
| 1151 | * |
| 1152 | * The max() function returns identical results but can be applied to more data types. |
| 1153 | */ |
| 1154 | extern float __attribute__((const, overloadable)) |
| 1155 | fmax(float a, float b); |
| 1156 | |
| 1157 | extern float2 __attribute__((const, overloadable)) |
| 1158 | fmax(float2 a, float2 b); |
| 1159 | |
| 1160 | extern float3 __attribute__((const, overloadable)) |
| 1161 | fmax(float3 a, float3 b); |
| 1162 | |
| 1163 | extern float4 __attribute__((const, overloadable)) |
| 1164 | fmax(float4 a, float4 b); |
| 1165 | |
| 1166 | extern float2 __attribute__((const, overloadable)) |
| 1167 | fmax(float2 a, float b); |
| 1168 | |
| 1169 | extern float3 __attribute__((const, overloadable)) |
| 1170 | fmax(float3 a, float b); |
| 1171 | |
| 1172 | extern float4 __attribute__((const, overloadable)) |
| 1173 | fmax(float4 a, float b); |
| 1174 | |
| 1175 | /* |
| 1176 | * fmin: Minimum of two floats |
| 1177 | * |
| 1178 | * Returns the minimum of a and b, i.e. (a > b ? b : a). |
| 1179 | * |
| 1180 | * The min() function returns identical results but can be applied to more data types. |
| 1181 | */ |
| 1182 | extern float __attribute__((const, overloadable)) |
| 1183 | fmin(float a, float b); |
| 1184 | |
| 1185 | extern float2 __attribute__((const, overloadable)) |
| 1186 | fmin(float2 a, float2 b); |
| 1187 | |
| 1188 | extern float3 __attribute__((const, overloadable)) |
| 1189 | fmin(float3 a, float3 b); |
| 1190 | |
| 1191 | extern float4 __attribute__((const, overloadable)) |
| 1192 | fmin(float4 a, float4 b); |
| 1193 | |
| 1194 | extern float2 __attribute__((const, overloadable)) |
| 1195 | fmin(float2 a, float b); |
| 1196 | |
| 1197 | extern float3 __attribute__((const, overloadable)) |
| 1198 | fmin(float3 a, float b); |
| 1199 | |
| 1200 | extern float4 __attribute__((const, overloadable)) |
| 1201 | fmin(float4 a, float b); |
| 1202 | |
| 1203 | /* |
| 1204 | * fmod: Modulo |
| 1205 | * |
| 1206 | * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero. |
| 1207 | * |
| 1208 | * The function remainder() is similar but rounds toward the closest interger. |
| 1209 | * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f) |
| 1210 | * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f). |
| 1211 | */ |
| 1212 | extern float __attribute__((const, overloadable)) |
| 1213 | fmod(float numerator, float denominator); |
| 1214 | |
| 1215 | extern float2 __attribute__((const, overloadable)) |
| 1216 | fmod(float2 numerator, float2 denominator); |
| 1217 | |
| 1218 | extern float3 __attribute__((const, overloadable)) |
| 1219 | fmod(float3 numerator, float3 denominator); |
| 1220 | |
| 1221 | extern float4 __attribute__((const, overloadable)) |
| 1222 | fmod(float4 numerator, float4 denominator); |
| 1223 | |
| 1224 | /* |
| 1225 | * fract: Positive fractional part |
| 1226 | * |
| 1227 | * Returns the positive fractional part of v, i.e. v - floor(v). |
| 1228 | * |
| 1229 | * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f. |
| 1230 | * fract(-1.3f, &val) returns 0.7f and sets val to -2.f. |
| 1231 | * |
| 1232 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 1233 | * v: Input value. |
| 1234 | * floor: If floor is not null, *floor will be set to the floor of v. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1235 | */ |
| 1236 | extern float __attribute__((overloadable)) |
| 1237 | fract(float v, float* floor); |
| 1238 | |
| 1239 | extern float2 __attribute__((overloadable)) |
| 1240 | fract(float2 v, float2* floor); |
| 1241 | |
| 1242 | extern float3 __attribute__((overloadable)) |
| 1243 | fract(float3 v, float3* floor); |
| 1244 | |
| 1245 | extern float4 __attribute__((overloadable)) |
| 1246 | fract(float4 v, float4* floor); |
| 1247 | |
| 1248 | static inline float __attribute__((const, overloadable)) |
| 1249 | fract(float v) { |
| 1250 | float unused; |
| 1251 | return fract(v, &unused); |
| 1252 | } |
| 1253 | |
| 1254 | static inline float2 __attribute__((const, overloadable)) |
| 1255 | fract(float2 v) { |
| 1256 | float2 unused; |
| 1257 | return fract(v, &unused); |
| 1258 | } |
| 1259 | |
| 1260 | static inline float3 __attribute__((const, overloadable)) |
| 1261 | fract(float3 v) { |
| 1262 | float3 unused; |
| 1263 | return fract(v, &unused); |
| 1264 | } |
| 1265 | |
| 1266 | static inline float4 __attribute__((const, overloadable)) |
| 1267 | fract(float4 v) { |
| 1268 | float4 unused; |
| 1269 | return fract(v, &unused); |
| 1270 | } |
| 1271 | |
| 1272 | /* |
| 1273 | * frexp: Binary mantissa and exponent |
| 1274 | * |
| 1275 | * Returns the binary mantissa and exponent of v, i.e. v == mantissa * 2 ^ exponent. |
| 1276 | * |
| 1277 | * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive). |
| 1278 | * |
| 1279 | * See ldexp() for the reverse operation. See also logb() and ilogb(). |
| 1280 | * |
| 1281 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 1282 | * v: Input value. |
| 1283 | * exponent: If exponent is not null, *exponent will be set to the exponent of v. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1284 | */ |
| 1285 | extern float __attribute__((overloadable)) |
| 1286 | frexp(float v, int* exponent); |
| 1287 | |
| 1288 | extern float2 __attribute__((overloadable)) |
| 1289 | frexp(float2 v, int2* exponent); |
| 1290 | |
| 1291 | extern float3 __attribute__((overloadable)) |
| 1292 | frexp(float3 v, int3* exponent); |
| 1293 | |
| 1294 | extern float4 __attribute__((overloadable)) |
| 1295 | frexp(float4 v, int4* exponent); |
| 1296 | |
| 1297 | /* |
| 1298 | * half_recip: Reciprocal computed to 16 bit precision |
| 1299 | * |
| 1300 | * Returns the approximate reciprocal of a value. |
| 1301 | * |
| 1302 | * The precision is that of a 16 bit floating point value. |
| 1303 | * |
| 1304 | * See also native_recip(). |
| 1305 | */ |
| 1306 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1307 | extern float __attribute__((const, overloadable)) |
| 1308 | half_recip(float v); |
| 1309 | #endif |
| 1310 | |
| 1311 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1312 | extern float2 __attribute__((const, overloadable)) |
| 1313 | half_recip(float2 v); |
| 1314 | #endif |
| 1315 | |
| 1316 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1317 | extern float3 __attribute__((const, overloadable)) |
| 1318 | half_recip(float3 v); |
| 1319 | #endif |
| 1320 | |
| 1321 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1322 | extern float4 __attribute__((const, overloadable)) |
| 1323 | half_recip(float4 v); |
| 1324 | #endif |
| 1325 | |
| 1326 | /* |
| 1327 | * half_rsqrt: Reciprocal of a square root computed to 16 bit precision |
| 1328 | * |
| 1329 | * Returns the approximate value of (1.f / sqrt(value)). |
| 1330 | * |
| 1331 | * The precision is that of a 16 bit floating point value. |
| 1332 | * |
| 1333 | * See also rsqrt(), native_rsqrt(). |
| 1334 | */ |
| 1335 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1336 | extern float __attribute__((const, overloadable)) |
| 1337 | half_rsqrt(float v); |
| 1338 | #endif |
| 1339 | |
| 1340 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1341 | extern float2 __attribute__((const, overloadable)) |
| 1342 | half_rsqrt(float2 v); |
| 1343 | #endif |
| 1344 | |
| 1345 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1346 | extern float3 __attribute__((const, overloadable)) |
| 1347 | half_rsqrt(float3 v); |
| 1348 | #endif |
| 1349 | |
| 1350 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1351 | extern float4 __attribute__((const, overloadable)) |
| 1352 | half_rsqrt(float4 v); |
| 1353 | #endif |
| 1354 | |
| 1355 | /* |
| 1356 | * half_sqrt: Square root computed to 16 bit precision |
| 1357 | * |
| 1358 | * Returns the approximate square root of a value. |
| 1359 | * |
| 1360 | * The precision is that of a 16 bit floating point value. |
| 1361 | * |
| 1362 | * See also sqrt(), native_sqrt(). |
| 1363 | */ |
| 1364 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1365 | extern float __attribute__((const, overloadable)) |
| 1366 | half_sqrt(float v); |
| 1367 | #endif |
| 1368 | |
| 1369 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1370 | extern float2 __attribute__((const, overloadable)) |
| 1371 | half_sqrt(float2 v); |
| 1372 | #endif |
| 1373 | |
| 1374 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1375 | extern float3 __attribute__((const, overloadable)) |
| 1376 | half_sqrt(float3 v); |
| 1377 | #endif |
| 1378 | |
| 1379 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 1380 | extern float4 __attribute__((const, overloadable)) |
| 1381 | half_sqrt(float4 v); |
| 1382 | #endif |
| 1383 | |
| 1384 | /* |
| 1385 | * hypot: Hypotenuse |
| 1386 | * |
| 1387 | * Returns the hypotenuse, i.e. sqrt(a * a + b * b). |
| 1388 | * |
| 1389 | * See also native_hypot(). |
| 1390 | */ |
| 1391 | extern float __attribute__((const, overloadable)) |
| 1392 | hypot(float a, float b); |
| 1393 | |
| 1394 | extern float2 __attribute__((const, overloadable)) |
| 1395 | hypot(float2 a, float2 b); |
| 1396 | |
| 1397 | extern float3 __attribute__((const, overloadable)) |
| 1398 | hypot(float3 a, float3 b); |
| 1399 | |
| 1400 | extern float4 __attribute__((const, overloadable)) |
| 1401 | hypot(float4 a, float4 b); |
| 1402 | |
| 1403 | /* |
| 1404 | * ilogb: Base two exponent |
| 1405 | * |
| 1406 | * Returns the base two exponent of a value, where the mantissa is between |
| 1407 | * 1.f (inclusive) and 2.f (exclusive). |
| 1408 | * |
| 1409 | * For example, ilogb(8.5f) returns 3. |
| 1410 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 1411 | * Because of the difference in mantissa, this number is one less than is returned by frexp(). |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1412 | * |
| 1413 | * logb() is similar but returns a float. |
| 1414 | */ |
| 1415 | extern int __attribute__((const, overloadable)) |
| 1416 | ilogb(float v); |
| 1417 | |
| 1418 | extern int2 __attribute__((const, overloadable)) |
| 1419 | ilogb(float2 v); |
| 1420 | |
| 1421 | extern int3 __attribute__((const, overloadable)) |
| 1422 | ilogb(float3 v); |
| 1423 | |
| 1424 | extern int4 __attribute__((const, overloadable)) |
| 1425 | ilogb(float4 v); |
| 1426 | |
| 1427 | /* |
| 1428 | * ldexp: Creates a floating point from mantissa and exponent |
| 1429 | * |
| 1430 | * Returns the floating point created from the mantissa and exponent, |
| 1431 | * i.e. (mantissa * 2 ^ exponent). |
| 1432 | * |
| 1433 | * See frexp() for the reverse operation. |
| 1434 | * |
| 1435 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 1436 | * mantissa: Mantissa. |
| 1437 | * exponent: Exponent, a single component or matching vector. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1438 | */ |
| 1439 | extern float __attribute__((const, overloadable)) |
| 1440 | ldexp(float mantissa, int exponent); |
| 1441 | |
| 1442 | extern float2 __attribute__((const, overloadable)) |
| 1443 | ldexp(float2 mantissa, int2 exponent); |
| 1444 | |
| 1445 | extern float3 __attribute__((const, overloadable)) |
| 1446 | ldexp(float3 mantissa, int3 exponent); |
| 1447 | |
| 1448 | extern float4 __attribute__((const, overloadable)) |
| 1449 | ldexp(float4 mantissa, int4 exponent); |
| 1450 | |
| 1451 | extern float2 __attribute__((const, overloadable)) |
| 1452 | ldexp(float2 mantissa, int exponent); |
| 1453 | |
| 1454 | extern float3 __attribute__((const, overloadable)) |
| 1455 | ldexp(float3 mantissa, int exponent); |
| 1456 | |
| 1457 | extern float4 __attribute__((const, overloadable)) |
| 1458 | ldexp(float4 mantissa, int exponent); |
| 1459 | |
| 1460 | /* |
| 1461 | * lgamma: Natural logarithm of the gamma function |
| 1462 | * |
| 1463 | * Returns the natural logarithm of the absolute value of the gamma function, |
| 1464 | * i.e. log(fabs(tgamma(v))). |
| 1465 | * |
| 1466 | * See also tgamma(). |
| 1467 | * |
| 1468 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 1469 | * sign_of_gamma: If sign_of_gamma is not null, *sign_of_gamma will be set to -1.f if the gamma of v is negative, otherwise to 1.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1470 | */ |
| 1471 | extern float __attribute__((const, overloadable)) |
| 1472 | lgamma(float v); |
| 1473 | |
| 1474 | extern float2 __attribute__((const, overloadable)) |
| 1475 | lgamma(float2 v); |
| 1476 | |
| 1477 | extern float3 __attribute__((const, overloadable)) |
| 1478 | lgamma(float3 v); |
| 1479 | |
| 1480 | extern float4 __attribute__((const, overloadable)) |
| 1481 | lgamma(float4 v); |
| 1482 | |
| 1483 | extern float __attribute__((overloadable)) |
| 1484 | lgamma(float v, int* sign_of_gamma); |
| 1485 | |
| 1486 | extern float2 __attribute__((overloadable)) |
| 1487 | lgamma(float2 v, int2* sign_of_gamma); |
| 1488 | |
| 1489 | extern float3 __attribute__((overloadable)) |
| 1490 | lgamma(float3 v, int3* sign_of_gamma); |
| 1491 | |
| 1492 | extern float4 __attribute__((overloadable)) |
| 1493 | lgamma(float4 v, int4* sign_of_gamma); |
| 1494 | |
| 1495 | /* |
| 1496 | * log: Natural logarithm |
| 1497 | * |
| 1498 | * Returns the natural logarithm. |
| 1499 | * |
| 1500 | * See also native_log(). |
| 1501 | */ |
| 1502 | extern float __attribute__((const, overloadable)) |
| 1503 | log(float v); |
| 1504 | |
| 1505 | extern float2 __attribute__((const, overloadable)) |
| 1506 | log(float2 v); |
| 1507 | |
| 1508 | extern float3 __attribute__((const, overloadable)) |
| 1509 | log(float3 v); |
| 1510 | |
| 1511 | extern float4 __attribute__((const, overloadable)) |
| 1512 | log(float4 v); |
| 1513 | |
| 1514 | /* |
| 1515 | * log10: Base 10 logarithm |
| 1516 | * |
| 1517 | * Returns the base 10 logarithm. |
| 1518 | * |
| 1519 | * See also native_log10(). |
| 1520 | */ |
| 1521 | extern float __attribute__((const, overloadable)) |
| 1522 | log10(float v); |
| 1523 | |
| 1524 | extern float2 __attribute__((const, overloadable)) |
| 1525 | log10(float2 v); |
| 1526 | |
| 1527 | extern float3 __attribute__((const, overloadable)) |
| 1528 | log10(float3 v); |
| 1529 | |
| 1530 | extern float4 __attribute__((const, overloadable)) |
| 1531 | log10(float4 v); |
| 1532 | |
| 1533 | /* |
| 1534 | * log1p: Natural logarithm of a value plus 1 |
| 1535 | * |
| 1536 | * Returns the natural logarithm of (v + 1.f). |
| 1537 | * |
| 1538 | * See also native_log1p(). |
| 1539 | */ |
| 1540 | extern float __attribute__((const, overloadable)) |
| 1541 | log1p(float v); |
| 1542 | |
| 1543 | extern float2 __attribute__((const, overloadable)) |
| 1544 | log1p(float2 v); |
| 1545 | |
| 1546 | extern float3 __attribute__((const, overloadable)) |
| 1547 | log1p(float3 v); |
| 1548 | |
| 1549 | extern float4 __attribute__((const, overloadable)) |
| 1550 | log1p(float4 v); |
| 1551 | |
| 1552 | /* |
| 1553 | * log2: Base 2 logarithm |
| 1554 | * |
| 1555 | * Returns the base 2 logarithm. |
| 1556 | * |
| 1557 | * See also native_log2(). |
| 1558 | */ |
| 1559 | extern float __attribute__((const, overloadable)) |
| 1560 | log2(float v); |
| 1561 | |
| 1562 | extern float2 __attribute__((const, overloadable)) |
| 1563 | log2(float2 v); |
| 1564 | |
| 1565 | extern float3 __attribute__((const, overloadable)) |
| 1566 | log2(float3 v); |
| 1567 | |
| 1568 | extern float4 __attribute__((const, overloadable)) |
| 1569 | log2(float4 v); |
| 1570 | |
| 1571 | /* |
| 1572 | * logb: Base two exponent |
| 1573 | * |
| 1574 | * Returns the base two exponent of a value, where the mantissa is between |
| 1575 | * 1.f (inclusive) and 2.f (exclusive). |
| 1576 | * |
| 1577 | * For example, logb(8.5f) returns 3.f. |
| 1578 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 1579 | * Because of the difference in mantissa, this number is one less than is returned by frexp(). |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1580 | * |
| 1581 | * ilogb() is similar but returns an integer. |
| 1582 | */ |
| 1583 | extern float __attribute__((const, overloadable)) |
| 1584 | logb(float v); |
| 1585 | |
| 1586 | extern float2 __attribute__((const, overloadable)) |
| 1587 | logb(float2 v); |
| 1588 | |
| 1589 | extern float3 __attribute__((const, overloadable)) |
| 1590 | logb(float3 v); |
| 1591 | |
| 1592 | extern float4 __attribute__((const, overloadable)) |
| 1593 | logb(float4 v); |
| 1594 | |
| 1595 | /* |
| 1596 | * mad: Multiply and add |
| 1597 | * |
| 1598 | * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset. |
| 1599 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 1600 | * This function is similar to fma(). fma() retains full precision of the multiplied result |
| 1601 | * and rounds only after the addition. mad() rounds after the multiplication and the addition. |
| 1602 | * In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1603 | */ |
| 1604 | extern float __attribute__((const, overloadable)) |
| 1605 | mad(float multiplicand1, float multiplicand2, float offset); |
| 1606 | |
| 1607 | extern float2 __attribute__((const, overloadable)) |
| 1608 | mad(float2 multiplicand1, float2 multiplicand2, float2 offset); |
| 1609 | |
| 1610 | extern float3 __attribute__((const, overloadable)) |
| 1611 | mad(float3 multiplicand1, float3 multiplicand2, float3 offset); |
| 1612 | |
| 1613 | extern float4 __attribute__((const, overloadable)) |
| 1614 | mad(float4 multiplicand1, float4 multiplicand2, float4 offset); |
| 1615 | |
| 1616 | /* |
| 1617 | * max: Maximum |
| 1618 | * |
| 1619 | * Returns the maximum value of two arguments. |
| 1620 | */ |
| 1621 | extern float __attribute__((const, overloadable)) |
| 1622 | max(float a, float b); |
| 1623 | |
| 1624 | extern float2 __attribute__((const, overloadable)) |
| 1625 | max(float2 a, float2 b); |
| 1626 | |
| 1627 | extern float3 __attribute__((const, overloadable)) |
| 1628 | max(float3 a, float3 b); |
| 1629 | |
| 1630 | extern float4 __attribute__((const, overloadable)) |
| 1631 | max(float4 a, float4 b); |
| 1632 | |
Jean-Luc Brouillet | 7cf263d | 2015-08-20 17:30:41 -0700 | [diff] [blame] | 1633 | extern float2 __attribute__((const, overloadable)) |
| 1634 | max(float2 a, float b); |
| 1635 | |
| 1636 | extern float3 __attribute__((const, overloadable)) |
| 1637 | max(float3 a, float b); |
| 1638 | |
| 1639 | extern float4 __attribute__((const, overloadable)) |
| 1640 | max(float4 a, float b); |
| 1641 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1642 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1643 | static inline char __attribute__((const, overloadable)) |
| 1644 | max(char a, char b) { |
| 1645 | return (a > b ? a : b); |
| 1646 | } |
| 1647 | #endif |
| 1648 | |
| 1649 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1650 | static inline uchar __attribute__((const, overloadable)) |
| 1651 | max(uchar a, uchar b) { |
| 1652 | return (a > b ? a : b); |
| 1653 | } |
| 1654 | #endif |
| 1655 | |
| 1656 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1657 | static inline short __attribute__((const, overloadable)) |
| 1658 | max(short a, short b) { |
| 1659 | return (a > b ? a : b); |
| 1660 | } |
| 1661 | #endif |
| 1662 | |
| 1663 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1664 | static inline ushort __attribute__((const, overloadable)) |
| 1665 | max(ushort a, ushort b) { |
| 1666 | return (a > b ? a : b); |
| 1667 | } |
| 1668 | #endif |
| 1669 | |
| 1670 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1671 | static inline int __attribute__((const, overloadable)) |
| 1672 | max(int a, int b) { |
| 1673 | return (a > b ? a : b); |
| 1674 | } |
| 1675 | #endif |
| 1676 | |
| 1677 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1678 | static inline uint __attribute__((const, overloadable)) |
| 1679 | max(uint a, uint b) { |
| 1680 | return (a > b ? a : b); |
| 1681 | } |
| 1682 | #endif |
| 1683 | |
| 1684 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1685 | static inline char2 __attribute__((const, overloadable)) |
| 1686 | max(char2 a, char2 b) { |
| 1687 | char2 tmp; |
| 1688 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1689 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1690 | return tmp; |
| 1691 | } |
| 1692 | #endif |
| 1693 | |
| 1694 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1695 | static inline uchar2 __attribute__((const, overloadable)) |
| 1696 | max(uchar2 a, uchar2 b) { |
| 1697 | uchar2 tmp; |
| 1698 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1699 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1700 | return tmp; |
| 1701 | } |
| 1702 | #endif |
| 1703 | |
| 1704 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1705 | static inline short2 __attribute__((const, overloadable)) |
| 1706 | max(short2 a, short2 b) { |
| 1707 | short2 tmp; |
| 1708 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1709 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1710 | return tmp; |
| 1711 | } |
| 1712 | #endif |
| 1713 | |
| 1714 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1715 | static inline ushort2 __attribute__((const, overloadable)) |
| 1716 | max(ushort2 a, ushort2 b) { |
| 1717 | ushort2 tmp; |
| 1718 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1719 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1720 | return tmp; |
| 1721 | } |
| 1722 | #endif |
| 1723 | |
| 1724 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1725 | static inline int2 __attribute__((const, overloadable)) |
| 1726 | max(int2 a, int2 b) { |
| 1727 | int2 tmp; |
| 1728 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1729 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1730 | return tmp; |
| 1731 | } |
| 1732 | #endif |
| 1733 | |
| 1734 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1735 | static inline uint2 __attribute__((const, overloadable)) |
| 1736 | max(uint2 a, uint2 b) { |
| 1737 | uint2 tmp; |
| 1738 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1739 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1740 | return tmp; |
| 1741 | } |
| 1742 | #endif |
| 1743 | |
| 1744 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1745 | static inline char3 __attribute__((const, overloadable)) |
| 1746 | max(char3 a, char3 b) { |
| 1747 | char3 tmp; |
| 1748 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1749 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1750 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1751 | return tmp; |
| 1752 | } |
| 1753 | #endif |
| 1754 | |
| 1755 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1756 | static inline uchar3 __attribute__((const, overloadable)) |
| 1757 | max(uchar3 a, uchar3 b) { |
| 1758 | uchar3 tmp; |
| 1759 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1760 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1761 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1762 | return tmp; |
| 1763 | } |
| 1764 | #endif |
| 1765 | |
| 1766 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1767 | static inline short3 __attribute__((const, overloadable)) |
| 1768 | max(short3 a, short3 b) { |
| 1769 | short3 tmp; |
| 1770 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1771 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1772 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1773 | return tmp; |
| 1774 | } |
| 1775 | #endif |
| 1776 | |
| 1777 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1778 | static inline ushort3 __attribute__((const, overloadable)) |
| 1779 | max(ushort3 a, ushort3 b) { |
| 1780 | ushort3 tmp; |
| 1781 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1782 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1783 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1784 | return tmp; |
| 1785 | } |
| 1786 | #endif |
| 1787 | |
| 1788 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1789 | static inline int3 __attribute__((const, overloadable)) |
| 1790 | max(int3 a, int3 b) { |
| 1791 | int3 tmp; |
| 1792 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1793 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1794 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1795 | return tmp; |
| 1796 | } |
| 1797 | #endif |
| 1798 | |
| 1799 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1800 | static inline uint3 __attribute__((const, overloadable)) |
| 1801 | max(uint3 a, uint3 b) { |
| 1802 | uint3 tmp; |
| 1803 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1804 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1805 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1806 | return tmp; |
| 1807 | } |
| 1808 | #endif |
| 1809 | |
| 1810 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1811 | static inline char4 __attribute__((const, overloadable)) |
| 1812 | max(char4 a, char4 b) { |
| 1813 | char4 tmp; |
| 1814 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1815 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1816 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1817 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 1818 | return tmp; |
| 1819 | } |
| 1820 | #endif |
| 1821 | |
| 1822 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1823 | static inline uchar4 __attribute__((const, overloadable)) |
| 1824 | max(uchar4 a, uchar4 b) { |
| 1825 | uchar4 tmp; |
| 1826 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1827 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1828 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1829 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 1830 | return tmp; |
| 1831 | } |
| 1832 | #endif |
| 1833 | |
| 1834 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1835 | static inline short4 __attribute__((const, overloadable)) |
| 1836 | max(short4 a, short4 b) { |
| 1837 | short4 tmp; |
| 1838 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1839 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1840 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1841 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 1842 | return tmp; |
| 1843 | } |
| 1844 | #endif |
| 1845 | |
| 1846 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1847 | static inline ushort4 __attribute__((const, overloadable)) |
| 1848 | max(ushort4 a, ushort4 b) { |
| 1849 | ushort4 tmp; |
| 1850 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1851 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1852 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1853 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 1854 | return tmp; |
| 1855 | } |
| 1856 | #endif |
| 1857 | |
| 1858 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1859 | static inline int4 __attribute__((const, overloadable)) |
| 1860 | max(int4 a, int4 b) { |
| 1861 | int4 tmp; |
| 1862 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1863 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1864 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1865 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 1866 | return tmp; |
| 1867 | } |
| 1868 | #endif |
| 1869 | |
| 1870 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 1871 | static inline uint4 __attribute__((const, overloadable)) |
| 1872 | max(uint4 a, uint4 b) { |
| 1873 | uint4 tmp; |
| 1874 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1875 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1876 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1877 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 1878 | return tmp; |
| 1879 | } |
| 1880 | #endif |
| 1881 | |
| 1882 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1883 | extern char __attribute__((const, overloadable)) |
| 1884 | max(char a, char b); |
| 1885 | #endif |
| 1886 | |
| 1887 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1888 | extern char2 __attribute__((const, overloadable)) |
| 1889 | max(char2 a, char2 b); |
| 1890 | #endif |
| 1891 | |
| 1892 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1893 | extern char3 __attribute__((const, overloadable)) |
| 1894 | max(char3 a, char3 b); |
| 1895 | #endif |
| 1896 | |
| 1897 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1898 | extern char4 __attribute__((const, overloadable)) |
| 1899 | max(char4 a, char4 b); |
| 1900 | #endif |
| 1901 | |
| 1902 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1903 | extern uchar __attribute__((const, overloadable)) |
| 1904 | max(uchar a, uchar b); |
| 1905 | #endif |
| 1906 | |
| 1907 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1908 | extern uchar2 __attribute__((const, overloadable)) |
| 1909 | max(uchar2 a, uchar2 b); |
| 1910 | #endif |
| 1911 | |
| 1912 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1913 | extern uchar3 __attribute__((const, overloadable)) |
| 1914 | max(uchar3 a, uchar3 b); |
| 1915 | #endif |
| 1916 | |
| 1917 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1918 | extern uchar4 __attribute__((const, overloadable)) |
| 1919 | max(uchar4 a, uchar4 b); |
| 1920 | #endif |
| 1921 | |
| 1922 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1923 | extern short __attribute__((const, overloadable)) |
| 1924 | max(short a, short b); |
| 1925 | #endif |
| 1926 | |
| 1927 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1928 | extern short2 __attribute__((const, overloadable)) |
| 1929 | max(short2 a, short2 b); |
| 1930 | #endif |
| 1931 | |
| 1932 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1933 | extern short3 __attribute__((const, overloadable)) |
| 1934 | max(short3 a, short3 b); |
| 1935 | #endif |
| 1936 | |
| 1937 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1938 | extern short4 __attribute__((const, overloadable)) |
| 1939 | max(short4 a, short4 b); |
| 1940 | #endif |
| 1941 | |
| 1942 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1943 | extern ushort __attribute__((const, overloadable)) |
| 1944 | max(ushort a, ushort b); |
| 1945 | #endif |
| 1946 | |
| 1947 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1948 | extern ushort2 __attribute__((const, overloadable)) |
| 1949 | max(ushort2 a, ushort2 b); |
| 1950 | #endif |
| 1951 | |
| 1952 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1953 | extern ushort3 __attribute__((const, overloadable)) |
| 1954 | max(ushort3 a, ushort3 b); |
| 1955 | #endif |
| 1956 | |
| 1957 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1958 | extern ushort4 __attribute__((const, overloadable)) |
| 1959 | max(ushort4 a, ushort4 b); |
| 1960 | #endif |
| 1961 | |
| 1962 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1963 | extern int __attribute__((const, overloadable)) |
| 1964 | max(int a, int b); |
| 1965 | #endif |
| 1966 | |
| 1967 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1968 | extern int2 __attribute__((const, overloadable)) |
| 1969 | max(int2 a, int2 b); |
| 1970 | #endif |
| 1971 | |
| 1972 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1973 | extern int3 __attribute__((const, overloadable)) |
| 1974 | max(int3 a, int3 b); |
| 1975 | #endif |
| 1976 | |
| 1977 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1978 | extern int4 __attribute__((const, overloadable)) |
| 1979 | max(int4 a, int4 b); |
| 1980 | #endif |
| 1981 | |
| 1982 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1983 | extern uint __attribute__((const, overloadable)) |
| 1984 | max(uint a, uint b); |
| 1985 | #endif |
| 1986 | |
| 1987 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1988 | extern uint2 __attribute__((const, overloadable)) |
| 1989 | max(uint2 a, uint2 b); |
| 1990 | #endif |
| 1991 | |
| 1992 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1993 | extern uint3 __attribute__((const, overloadable)) |
| 1994 | max(uint3 a, uint3 b); |
| 1995 | #endif |
| 1996 | |
| 1997 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 1998 | extern uint4 __attribute__((const, overloadable)) |
| 1999 | max(uint4 a, uint4 b); |
| 2000 | #endif |
| 2001 | |
| 2002 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2003 | extern long __attribute__((const, overloadable)) |
| 2004 | max(long a, long b); |
| 2005 | #endif |
| 2006 | |
| 2007 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2008 | extern long2 __attribute__((const, overloadable)) |
| 2009 | max(long2 a, long2 b); |
| 2010 | #endif |
| 2011 | |
| 2012 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2013 | extern long3 __attribute__((const, overloadable)) |
| 2014 | max(long3 a, long3 b); |
| 2015 | #endif |
| 2016 | |
| 2017 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2018 | extern long4 __attribute__((const, overloadable)) |
| 2019 | max(long4 a, long4 b); |
| 2020 | #endif |
| 2021 | |
| 2022 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2023 | extern ulong __attribute__((const, overloadable)) |
| 2024 | max(ulong a, ulong b); |
| 2025 | #endif |
| 2026 | |
| 2027 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2028 | extern ulong2 __attribute__((const, overloadable)) |
| 2029 | max(ulong2 a, ulong2 b); |
| 2030 | #endif |
| 2031 | |
| 2032 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2033 | extern ulong3 __attribute__((const, overloadable)) |
| 2034 | max(ulong3 a, ulong3 b); |
| 2035 | #endif |
| 2036 | |
| 2037 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2038 | extern ulong4 __attribute__((const, overloadable)) |
| 2039 | max(ulong4 a, ulong4 b); |
| 2040 | #endif |
| 2041 | |
| 2042 | /* |
| 2043 | * min: Minimum |
| 2044 | * |
| 2045 | * Returns the minimum value of two arguments. |
| 2046 | */ |
| 2047 | extern float __attribute__((const, overloadable)) |
| 2048 | min(float a, float b); |
| 2049 | |
| 2050 | extern float2 __attribute__((const, overloadable)) |
| 2051 | min(float2 a, float2 b); |
| 2052 | |
| 2053 | extern float3 __attribute__((const, overloadable)) |
| 2054 | min(float3 a, float3 b); |
| 2055 | |
| 2056 | extern float4 __attribute__((const, overloadable)) |
| 2057 | min(float4 a, float4 b); |
| 2058 | |
Jean-Luc Brouillet | 7cf263d | 2015-08-20 17:30:41 -0700 | [diff] [blame] | 2059 | extern float2 __attribute__((const, overloadable)) |
| 2060 | min(float2 a, float b); |
| 2061 | |
| 2062 | extern float3 __attribute__((const, overloadable)) |
| 2063 | min(float3 a, float b); |
| 2064 | |
| 2065 | extern float4 __attribute__((const, overloadable)) |
| 2066 | min(float4 a, float b); |
| 2067 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2068 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2069 | static inline char __attribute__((const, overloadable)) |
| 2070 | min(char a, char b) { |
| 2071 | return (a < b ? a : b); |
| 2072 | } |
| 2073 | #endif |
| 2074 | |
| 2075 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2076 | static inline uchar __attribute__((const, overloadable)) |
| 2077 | min(uchar a, uchar b) { |
| 2078 | return (a < b ? a : b); |
| 2079 | } |
| 2080 | #endif |
| 2081 | |
| 2082 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2083 | static inline short __attribute__((const, overloadable)) |
| 2084 | min(short a, short b) { |
| 2085 | return (a < b ? a : b); |
| 2086 | } |
| 2087 | #endif |
| 2088 | |
| 2089 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2090 | static inline ushort __attribute__((const, overloadable)) |
| 2091 | min(ushort a, ushort b) { |
| 2092 | return (a < b ? a : b); |
| 2093 | } |
| 2094 | #endif |
| 2095 | |
| 2096 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2097 | static inline int __attribute__((const, overloadable)) |
| 2098 | min(int a, int b) { |
| 2099 | return (a < b ? a : b); |
| 2100 | } |
| 2101 | #endif |
| 2102 | |
| 2103 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2104 | static inline uint __attribute__((const, overloadable)) |
| 2105 | min(uint a, uint b) { |
| 2106 | return (a < b ? a : b); |
| 2107 | } |
| 2108 | #endif |
| 2109 | |
| 2110 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2111 | static inline char2 __attribute__((const, overloadable)) |
| 2112 | min(char2 a, char2 b) { |
| 2113 | char2 tmp; |
| 2114 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2115 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2116 | return tmp; |
| 2117 | } |
| 2118 | #endif |
| 2119 | |
| 2120 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2121 | static inline uchar2 __attribute__((const, overloadable)) |
| 2122 | min(uchar2 a, uchar2 b) { |
| 2123 | uchar2 tmp; |
| 2124 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2125 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2126 | return tmp; |
| 2127 | } |
| 2128 | #endif |
| 2129 | |
| 2130 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2131 | static inline short2 __attribute__((const, overloadable)) |
| 2132 | min(short2 a, short2 b) { |
| 2133 | short2 tmp; |
| 2134 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2135 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2136 | return tmp; |
| 2137 | } |
| 2138 | #endif |
| 2139 | |
| 2140 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2141 | static inline ushort2 __attribute__((const, overloadable)) |
| 2142 | min(ushort2 a, ushort2 b) { |
| 2143 | ushort2 tmp; |
| 2144 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2145 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2146 | return tmp; |
| 2147 | } |
| 2148 | #endif |
| 2149 | |
| 2150 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2151 | static inline int2 __attribute__((const, overloadable)) |
| 2152 | min(int2 a, int2 b) { |
| 2153 | int2 tmp; |
| 2154 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2155 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2156 | return tmp; |
| 2157 | } |
| 2158 | #endif |
| 2159 | |
| 2160 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2161 | static inline uint2 __attribute__((const, overloadable)) |
| 2162 | min(uint2 a, uint2 b) { |
| 2163 | uint2 tmp; |
| 2164 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2165 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2166 | return tmp; |
| 2167 | } |
| 2168 | #endif |
| 2169 | |
| 2170 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2171 | static inline char3 __attribute__((const, overloadable)) |
| 2172 | min(char3 a, char3 b) { |
| 2173 | char3 tmp; |
| 2174 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2175 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2176 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2177 | return tmp; |
| 2178 | } |
| 2179 | #endif |
| 2180 | |
| 2181 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2182 | static inline uchar3 __attribute__((const, overloadable)) |
| 2183 | min(uchar3 a, uchar3 b) { |
| 2184 | uchar3 tmp; |
| 2185 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2186 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2187 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2188 | return tmp; |
| 2189 | } |
| 2190 | #endif |
| 2191 | |
| 2192 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2193 | static inline short3 __attribute__((const, overloadable)) |
| 2194 | min(short3 a, short3 b) { |
| 2195 | short3 tmp; |
| 2196 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2197 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2198 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2199 | return tmp; |
| 2200 | } |
| 2201 | #endif |
| 2202 | |
| 2203 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2204 | static inline ushort3 __attribute__((const, overloadable)) |
| 2205 | min(ushort3 a, ushort3 b) { |
| 2206 | ushort3 tmp; |
| 2207 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2208 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2209 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2210 | return tmp; |
| 2211 | } |
| 2212 | #endif |
| 2213 | |
| 2214 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2215 | static inline int3 __attribute__((const, overloadable)) |
| 2216 | min(int3 a, int3 b) { |
| 2217 | int3 tmp; |
| 2218 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2219 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2220 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2221 | return tmp; |
| 2222 | } |
| 2223 | #endif |
| 2224 | |
| 2225 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2226 | static inline uint3 __attribute__((const, overloadable)) |
| 2227 | min(uint3 a, uint3 b) { |
| 2228 | uint3 tmp; |
| 2229 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2230 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2231 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2232 | return tmp; |
| 2233 | } |
| 2234 | #endif |
| 2235 | |
| 2236 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2237 | static inline char4 __attribute__((const, overloadable)) |
| 2238 | min(char4 a, char4 b) { |
| 2239 | char4 tmp; |
| 2240 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2241 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2242 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2243 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 2244 | return tmp; |
| 2245 | } |
| 2246 | #endif |
| 2247 | |
| 2248 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2249 | static inline uchar4 __attribute__((const, overloadable)) |
| 2250 | min(uchar4 a, uchar4 b) { |
| 2251 | uchar4 tmp; |
| 2252 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2253 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2254 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2255 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 2256 | return tmp; |
| 2257 | } |
| 2258 | #endif |
| 2259 | |
| 2260 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2261 | static inline short4 __attribute__((const, overloadable)) |
| 2262 | min(short4 a, short4 b) { |
| 2263 | short4 tmp; |
| 2264 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2265 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2266 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2267 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 2268 | return tmp; |
| 2269 | } |
| 2270 | #endif |
| 2271 | |
| 2272 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2273 | static inline ushort4 __attribute__((const, overloadable)) |
| 2274 | min(ushort4 a, ushort4 b) { |
| 2275 | ushort4 tmp; |
| 2276 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2277 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2278 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2279 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 2280 | return tmp; |
| 2281 | } |
| 2282 | #endif |
| 2283 | |
| 2284 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2285 | static inline int4 __attribute__((const, overloadable)) |
| 2286 | min(int4 a, int4 b) { |
| 2287 | int4 tmp; |
| 2288 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2289 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2290 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2291 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 2292 | return tmp; |
| 2293 | } |
| 2294 | #endif |
| 2295 | |
| 2296 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2297 | static inline uint4 __attribute__((const, overloadable)) |
| 2298 | min(uint4 a, uint4 b) { |
| 2299 | uint4 tmp; |
| 2300 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 2301 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 2302 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 2303 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 2304 | return tmp; |
| 2305 | } |
| 2306 | #endif |
| 2307 | |
| 2308 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2309 | extern char __attribute__((const, overloadable)) |
| 2310 | min(char a, char b); |
| 2311 | #endif |
| 2312 | |
| 2313 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2314 | extern char2 __attribute__((const, overloadable)) |
| 2315 | min(char2 a, char2 b); |
| 2316 | #endif |
| 2317 | |
| 2318 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2319 | extern char3 __attribute__((const, overloadable)) |
| 2320 | min(char3 a, char3 b); |
| 2321 | #endif |
| 2322 | |
| 2323 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2324 | extern char4 __attribute__((const, overloadable)) |
| 2325 | min(char4 a, char4 b); |
| 2326 | #endif |
| 2327 | |
| 2328 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2329 | extern uchar __attribute__((const, overloadable)) |
| 2330 | min(uchar a, uchar b); |
| 2331 | #endif |
| 2332 | |
| 2333 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2334 | extern uchar2 __attribute__((const, overloadable)) |
| 2335 | min(uchar2 a, uchar2 b); |
| 2336 | #endif |
| 2337 | |
| 2338 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2339 | extern uchar3 __attribute__((const, overloadable)) |
| 2340 | min(uchar3 a, uchar3 b); |
| 2341 | #endif |
| 2342 | |
| 2343 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2344 | extern uchar4 __attribute__((const, overloadable)) |
| 2345 | min(uchar4 a, uchar4 b); |
| 2346 | #endif |
| 2347 | |
| 2348 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2349 | extern short __attribute__((const, overloadable)) |
| 2350 | min(short a, short b); |
| 2351 | #endif |
| 2352 | |
| 2353 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2354 | extern short2 __attribute__((const, overloadable)) |
| 2355 | min(short2 a, short2 b); |
| 2356 | #endif |
| 2357 | |
| 2358 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2359 | extern short3 __attribute__((const, overloadable)) |
| 2360 | min(short3 a, short3 b); |
| 2361 | #endif |
| 2362 | |
| 2363 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2364 | extern short4 __attribute__((const, overloadable)) |
| 2365 | min(short4 a, short4 b); |
| 2366 | #endif |
| 2367 | |
| 2368 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2369 | extern ushort __attribute__((const, overloadable)) |
| 2370 | min(ushort a, ushort b); |
| 2371 | #endif |
| 2372 | |
| 2373 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2374 | extern ushort2 __attribute__((const, overloadable)) |
| 2375 | min(ushort2 a, ushort2 b); |
| 2376 | #endif |
| 2377 | |
| 2378 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2379 | extern ushort3 __attribute__((const, overloadable)) |
| 2380 | min(ushort3 a, ushort3 b); |
| 2381 | #endif |
| 2382 | |
| 2383 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2384 | extern ushort4 __attribute__((const, overloadable)) |
| 2385 | min(ushort4 a, ushort4 b); |
| 2386 | #endif |
| 2387 | |
| 2388 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2389 | extern int __attribute__((const, overloadable)) |
| 2390 | min(int a, int b); |
| 2391 | #endif |
| 2392 | |
| 2393 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2394 | extern int2 __attribute__((const, overloadable)) |
| 2395 | min(int2 a, int2 b); |
| 2396 | #endif |
| 2397 | |
| 2398 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2399 | extern int3 __attribute__((const, overloadable)) |
| 2400 | min(int3 a, int3 b); |
| 2401 | #endif |
| 2402 | |
| 2403 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2404 | extern int4 __attribute__((const, overloadable)) |
| 2405 | min(int4 a, int4 b); |
| 2406 | #endif |
| 2407 | |
| 2408 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2409 | extern uint __attribute__((const, overloadable)) |
| 2410 | min(uint a, uint b); |
| 2411 | #endif |
| 2412 | |
| 2413 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2414 | extern uint2 __attribute__((const, overloadable)) |
| 2415 | min(uint2 a, uint2 b); |
| 2416 | #endif |
| 2417 | |
| 2418 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2419 | extern uint3 __attribute__((const, overloadable)) |
| 2420 | min(uint3 a, uint3 b); |
| 2421 | #endif |
| 2422 | |
| 2423 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2424 | extern uint4 __attribute__((const, overloadable)) |
| 2425 | min(uint4 a, uint4 b); |
| 2426 | #endif |
| 2427 | |
| 2428 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2429 | extern long __attribute__((const, overloadable)) |
| 2430 | min(long a, long b); |
| 2431 | #endif |
| 2432 | |
| 2433 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2434 | extern long2 __attribute__((const, overloadable)) |
| 2435 | min(long2 a, long2 b); |
| 2436 | #endif |
| 2437 | |
| 2438 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2439 | extern long3 __attribute__((const, overloadable)) |
| 2440 | min(long3 a, long3 b); |
| 2441 | #endif |
| 2442 | |
| 2443 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2444 | extern long4 __attribute__((const, overloadable)) |
| 2445 | min(long4 a, long4 b); |
| 2446 | #endif |
| 2447 | |
| 2448 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2449 | extern ulong __attribute__((const, overloadable)) |
| 2450 | min(ulong a, ulong b); |
| 2451 | #endif |
| 2452 | |
| 2453 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2454 | extern ulong2 __attribute__((const, overloadable)) |
| 2455 | min(ulong2 a, ulong2 b); |
| 2456 | #endif |
| 2457 | |
| 2458 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2459 | extern ulong3 __attribute__((const, overloadable)) |
| 2460 | min(ulong3 a, ulong3 b); |
| 2461 | #endif |
| 2462 | |
| 2463 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2464 | extern ulong4 __attribute__((const, overloadable)) |
| 2465 | min(ulong4 a, ulong4 b); |
| 2466 | #endif |
| 2467 | |
| 2468 | /* |
| 2469 | * mix: Mixes two values |
| 2470 | * |
| 2471 | * Returns start + ((stop - start) * fraction). |
| 2472 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2473 | * This can be useful for mixing two values. For example, to create a new color that is |
| 2474 | * 40% color1 and 60% color2, use mix(color1, color2, 0.6f). |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2475 | */ |
| 2476 | extern float __attribute__((const, overloadable)) |
| 2477 | mix(float start, float stop, float fraction); |
| 2478 | |
| 2479 | extern float2 __attribute__((const, overloadable)) |
| 2480 | mix(float2 start, float2 stop, float2 fraction); |
| 2481 | |
| 2482 | extern float3 __attribute__((const, overloadable)) |
| 2483 | mix(float3 start, float3 stop, float3 fraction); |
| 2484 | |
| 2485 | extern float4 __attribute__((const, overloadable)) |
| 2486 | mix(float4 start, float4 stop, float4 fraction); |
| 2487 | |
| 2488 | extern float2 __attribute__((const, overloadable)) |
| 2489 | mix(float2 start, float2 stop, float fraction); |
| 2490 | |
| 2491 | extern float3 __attribute__((const, overloadable)) |
| 2492 | mix(float3 start, float3 stop, float fraction); |
| 2493 | |
| 2494 | extern float4 __attribute__((const, overloadable)) |
| 2495 | mix(float4 start, float4 stop, float fraction); |
| 2496 | |
| 2497 | /* |
| 2498 | * modf: Integral and fractional components |
| 2499 | * |
| 2500 | * Returns the integral and fractional components of a number. |
| 2501 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2502 | * Both components will have the same sign as x. For example, for an input of -3.72f, |
Pirama Arumuga Nainar | e6128ff | 2015-12-06 17:32:42 -0800 | [diff] [blame^] | 2503 | * *integral_part will be set to -3.f and .72f will be returned. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2504 | * |
| 2505 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2506 | * v: Source value. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 2507 | * integral_part: *integral_part will be set to the integral portion of the number. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2508 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2509 | * Returns: Floating point portion of the value. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2510 | */ |
| 2511 | extern float __attribute__((overloadable)) |
| 2512 | modf(float v, float* integral_part); |
| 2513 | |
| 2514 | extern float2 __attribute__((overloadable)) |
| 2515 | modf(float2 v, float2* integral_part); |
| 2516 | |
| 2517 | extern float3 __attribute__((overloadable)) |
| 2518 | modf(float3 v, float3* integral_part); |
| 2519 | |
| 2520 | extern float4 __attribute__((overloadable)) |
| 2521 | modf(float4 v, float4* integral_part); |
| 2522 | |
| 2523 | /* |
| 2524 | * nan: Not a Number |
| 2525 | * |
| 2526 | * Returns a NaN value (Not a Number). |
| 2527 | * |
| 2528 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 2529 | * v: Not used. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2530 | */ |
| 2531 | extern float __attribute__((const, overloadable)) |
| 2532 | nan(uint v); |
| 2533 | |
| 2534 | /* |
| 2535 | * native_acos: Approximate inverse cosine |
| 2536 | * |
| 2537 | * Returns the approximate inverse cosine, in radians. |
| 2538 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2539 | * This function yields undefined results from input values less than -1 or greater than 1. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2540 | * |
| 2541 | * See also acos(). |
| 2542 | */ |
| 2543 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2544 | extern float __attribute__((const, overloadable)) |
| 2545 | native_acos(float v); |
| 2546 | #endif |
| 2547 | |
| 2548 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2549 | extern float2 __attribute__((const, overloadable)) |
| 2550 | native_acos(float2 v); |
| 2551 | #endif |
| 2552 | |
| 2553 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2554 | extern float3 __attribute__((const, overloadable)) |
| 2555 | native_acos(float3 v); |
| 2556 | #endif |
| 2557 | |
| 2558 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2559 | extern float4 __attribute__((const, overloadable)) |
| 2560 | native_acos(float4 v); |
| 2561 | #endif |
| 2562 | |
| 2563 | /* |
| 2564 | * native_acosh: Approximate inverse hyperbolic cosine |
| 2565 | * |
| 2566 | * Returns the approximate inverse hyperbolic cosine, in radians. |
| 2567 | * |
| 2568 | * See also acosh(). |
| 2569 | */ |
| 2570 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2571 | extern float __attribute__((const, overloadable)) |
| 2572 | native_acosh(float v); |
| 2573 | #endif |
| 2574 | |
| 2575 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2576 | extern float2 __attribute__((const, overloadable)) |
| 2577 | native_acosh(float2 v); |
| 2578 | #endif |
| 2579 | |
| 2580 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2581 | extern float3 __attribute__((const, overloadable)) |
| 2582 | native_acosh(float3 v); |
| 2583 | #endif |
| 2584 | |
| 2585 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2586 | extern float4 __attribute__((const, overloadable)) |
| 2587 | native_acosh(float4 v); |
| 2588 | #endif |
| 2589 | |
| 2590 | /* |
| 2591 | * native_acospi: Approximate inverse cosine divided by pi |
| 2592 | * |
| 2593 | * Returns the approximate inverse cosine in radians, divided by pi. |
| 2594 | * |
| 2595 | * To get an inverse cosine measured in degrees, use acospi(a) * 180.f. |
| 2596 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2597 | * This function yields undefined results from input values less than -1 or greater than 1. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2598 | * |
| 2599 | * See also acospi(). |
| 2600 | */ |
| 2601 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2602 | extern float __attribute__((const, overloadable)) |
| 2603 | native_acospi(float v); |
| 2604 | #endif |
| 2605 | |
| 2606 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2607 | extern float2 __attribute__((const, overloadable)) |
| 2608 | native_acospi(float2 v); |
| 2609 | #endif |
| 2610 | |
| 2611 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2612 | extern float3 __attribute__((const, overloadable)) |
| 2613 | native_acospi(float3 v); |
| 2614 | #endif |
| 2615 | |
| 2616 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2617 | extern float4 __attribute__((const, overloadable)) |
| 2618 | native_acospi(float4 v); |
| 2619 | #endif |
| 2620 | |
| 2621 | /* |
| 2622 | * native_asin: Approximate inverse sine |
| 2623 | * |
| 2624 | * Returns the approximate inverse sine, in radians. |
| 2625 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2626 | * This function yields undefined results from input values less than -1 or greater than 1. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2627 | * |
| 2628 | * See also asin(). |
| 2629 | */ |
| 2630 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2631 | extern float __attribute__((const, overloadable)) |
| 2632 | native_asin(float v); |
| 2633 | #endif |
| 2634 | |
| 2635 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2636 | extern float2 __attribute__((const, overloadable)) |
| 2637 | native_asin(float2 v); |
| 2638 | #endif |
| 2639 | |
| 2640 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2641 | extern float3 __attribute__((const, overloadable)) |
| 2642 | native_asin(float3 v); |
| 2643 | #endif |
| 2644 | |
| 2645 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2646 | extern float4 __attribute__((const, overloadable)) |
| 2647 | native_asin(float4 v); |
| 2648 | #endif |
| 2649 | |
| 2650 | /* |
| 2651 | * native_asinh: Approximate inverse hyperbolic sine |
| 2652 | * |
| 2653 | * Returns the approximate inverse hyperbolic sine, in radians. |
| 2654 | * |
| 2655 | * See also asinh(). |
| 2656 | */ |
| 2657 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2658 | extern float __attribute__((const, overloadable)) |
| 2659 | native_asinh(float v); |
| 2660 | #endif |
| 2661 | |
| 2662 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2663 | extern float2 __attribute__((const, overloadable)) |
| 2664 | native_asinh(float2 v); |
| 2665 | #endif |
| 2666 | |
| 2667 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2668 | extern float3 __attribute__((const, overloadable)) |
| 2669 | native_asinh(float3 v); |
| 2670 | #endif |
| 2671 | |
| 2672 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2673 | extern float4 __attribute__((const, overloadable)) |
| 2674 | native_asinh(float4 v); |
| 2675 | #endif |
| 2676 | |
| 2677 | /* |
| 2678 | * native_asinpi: Approximate inverse sine divided by pi |
| 2679 | * |
| 2680 | * Returns the approximate inverse sine in radians, divided by pi. |
| 2681 | * |
| 2682 | * To get an inverse sine measured in degrees, use asinpi(a) * 180.f. |
| 2683 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2684 | * This function yields undefined results from input values less than -1 or greater than 1. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2685 | * |
| 2686 | * See also asinpi(). |
| 2687 | */ |
| 2688 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2689 | extern float __attribute__((const, overloadable)) |
| 2690 | native_asinpi(float v); |
| 2691 | #endif |
| 2692 | |
| 2693 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2694 | extern float2 __attribute__((const, overloadable)) |
| 2695 | native_asinpi(float2 v); |
| 2696 | #endif |
| 2697 | |
| 2698 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2699 | extern float3 __attribute__((const, overloadable)) |
| 2700 | native_asinpi(float3 v); |
| 2701 | #endif |
| 2702 | |
| 2703 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2704 | extern float4 __attribute__((const, overloadable)) |
| 2705 | native_asinpi(float4 v); |
| 2706 | #endif |
| 2707 | |
| 2708 | /* |
| 2709 | * native_atan: Approximate inverse tangent |
| 2710 | * |
| 2711 | * Returns the approximate inverse tangent, in radians. |
| 2712 | * |
| 2713 | * See also atan(). |
| 2714 | */ |
| 2715 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2716 | extern float __attribute__((const, overloadable)) |
| 2717 | native_atan(float v); |
| 2718 | #endif |
| 2719 | |
| 2720 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2721 | extern float2 __attribute__((const, overloadable)) |
| 2722 | native_atan(float2 v); |
| 2723 | #endif |
| 2724 | |
| 2725 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2726 | extern float3 __attribute__((const, overloadable)) |
| 2727 | native_atan(float3 v); |
| 2728 | #endif |
| 2729 | |
| 2730 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2731 | extern float4 __attribute__((const, overloadable)) |
| 2732 | native_atan(float4 v); |
| 2733 | #endif |
| 2734 | |
| 2735 | /* |
| 2736 | * native_atan2: Approximate inverse tangent of a ratio |
| 2737 | * |
| 2738 | * Returns the approximate inverse tangent of (numerator / denominator), in radians. |
| 2739 | * |
| 2740 | * See also atan2(). |
| 2741 | * |
| 2742 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2743 | * numerator: Numerator. |
| 2744 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2745 | */ |
| 2746 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2747 | extern float __attribute__((const, overloadable)) |
| 2748 | native_atan2(float numerator, float denominator); |
| 2749 | #endif |
| 2750 | |
| 2751 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2752 | extern float2 __attribute__((const, overloadable)) |
| 2753 | native_atan2(float2 numerator, float2 denominator); |
| 2754 | #endif |
| 2755 | |
| 2756 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2757 | extern float3 __attribute__((const, overloadable)) |
| 2758 | native_atan2(float3 numerator, float3 denominator); |
| 2759 | #endif |
| 2760 | |
| 2761 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2762 | extern float4 __attribute__((const, overloadable)) |
| 2763 | native_atan2(float4 numerator, float4 denominator); |
| 2764 | #endif |
| 2765 | |
| 2766 | /* |
| 2767 | * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi |
| 2768 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2769 | * Returns the approximate inverse tangent of (numerator / denominator), |
| 2770 | * in radians, divided by pi. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2771 | * |
| 2772 | * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f. |
| 2773 | * |
| 2774 | * See also atan2pi(). |
| 2775 | * |
| 2776 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2777 | * numerator: Numerator. |
| 2778 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2779 | */ |
| 2780 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2781 | extern float __attribute__((const, overloadable)) |
| 2782 | native_atan2pi(float numerator, float denominator); |
| 2783 | #endif |
| 2784 | |
| 2785 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2786 | extern float2 __attribute__((const, overloadable)) |
| 2787 | native_atan2pi(float2 numerator, float2 denominator); |
| 2788 | #endif |
| 2789 | |
| 2790 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2791 | extern float3 __attribute__((const, overloadable)) |
| 2792 | native_atan2pi(float3 numerator, float3 denominator); |
| 2793 | #endif |
| 2794 | |
| 2795 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2796 | extern float4 __attribute__((const, overloadable)) |
| 2797 | native_atan2pi(float4 numerator, float4 denominator); |
| 2798 | #endif |
| 2799 | |
| 2800 | /* |
| 2801 | * native_atanh: Approximate inverse hyperbolic tangent |
| 2802 | * |
| 2803 | * Returns the approximate inverse hyperbolic tangent, in radians. |
| 2804 | * |
| 2805 | * See also atanh(). |
| 2806 | */ |
| 2807 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2808 | extern float __attribute__((const, overloadable)) |
| 2809 | native_atanh(float v); |
| 2810 | #endif |
| 2811 | |
| 2812 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2813 | extern float2 __attribute__((const, overloadable)) |
| 2814 | native_atanh(float2 v); |
| 2815 | #endif |
| 2816 | |
| 2817 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2818 | extern float3 __attribute__((const, overloadable)) |
| 2819 | native_atanh(float3 v); |
| 2820 | #endif |
| 2821 | |
| 2822 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2823 | extern float4 __attribute__((const, overloadable)) |
| 2824 | native_atanh(float4 v); |
| 2825 | #endif |
| 2826 | |
| 2827 | /* |
| 2828 | * native_atanpi: Approximate inverse tangent divided by pi |
| 2829 | * |
| 2830 | * Returns the approximate inverse tangent in radians, divided by pi. |
| 2831 | * |
| 2832 | * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f. |
| 2833 | * |
| 2834 | * See also atanpi(). |
| 2835 | */ |
| 2836 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2837 | extern float __attribute__((const, overloadable)) |
| 2838 | native_atanpi(float v); |
| 2839 | #endif |
| 2840 | |
| 2841 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2842 | extern float2 __attribute__((const, overloadable)) |
| 2843 | native_atanpi(float2 v); |
| 2844 | #endif |
| 2845 | |
| 2846 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2847 | extern float3 __attribute__((const, overloadable)) |
| 2848 | native_atanpi(float3 v); |
| 2849 | #endif |
| 2850 | |
| 2851 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2852 | extern float4 __attribute__((const, overloadable)) |
| 2853 | native_atanpi(float4 v); |
| 2854 | #endif |
| 2855 | |
| 2856 | /* |
| 2857 | * native_cbrt: Approximate cube root |
| 2858 | * |
| 2859 | * Returns the approximate cubic root. |
| 2860 | * |
| 2861 | * See also cbrt(). |
| 2862 | */ |
| 2863 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2864 | extern float __attribute__((const, overloadable)) |
| 2865 | native_cbrt(float v); |
| 2866 | #endif |
| 2867 | |
| 2868 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2869 | extern float2 __attribute__((const, overloadable)) |
| 2870 | native_cbrt(float2 v); |
| 2871 | #endif |
| 2872 | |
| 2873 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2874 | extern float3 __attribute__((const, overloadable)) |
| 2875 | native_cbrt(float3 v); |
| 2876 | #endif |
| 2877 | |
| 2878 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2879 | extern float4 __attribute__((const, overloadable)) |
| 2880 | native_cbrt(float4 v); |
| 2881 | #endif |
| 2882 | |
| 2883 | /* |
| 2884 | * native_cos: Approximate cosine |
| 2885 | * |
| 2886 | * Returns the approximate cosine of an angle measured in radians. |
| 2887 | * |
| 2888 | * See also cos(). |
| 2889 | */ |
| 2890 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2891 | extern float __attribute__((const, overloadable)) |
| 2892 | native_cos(float v); |
| 2893 | #endif |
| 2894 | |
| 2895 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2896 | extern float2 __attribute__((const, overloadable)) |
| 2897 | native_cos(float2 v); |
| 2898 | #endif |
| 2899 | |
| 2900 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2901 | extern float3 __attribute__((const, overloadable)) |
| 2902 | native_cos(float3 v); |
| 2903 | #endif |
| 2904 | |
| 2905 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2906 | extern float4 __attribute__((const, overloadable)) |
| 2907 | native_cos(float4 v); |
| 2908 | #endif |
| 2909 | |
| 2910 | /* |
| 2911 | * native_cosh: Approximate hypebolic cosine |
| 2912 | * |
| 2913 | * Returns the approximate hypebolic cosine. |
| 2914 | * |
| 2915 | * See also cosh(). |
| 2916 | */ |
| 2917 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2918 | extern float __attribute__((const, overloadable)) |
| 2919 | native_cosh(float v); |
| 2920 | #endif |
| 2921 | |
| 2922 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2923 | extern float2 __attribute__((const, overloadable)) |
| 2924 | native_cosh(float2 v); |
| 2925 | #endif |
| 2926 | |
| 2927 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2928 | extern float3 __attribute__((const, overloadable)) |
| 2929 | native_cosh(float3 v); |
| 2930 | #endif |
| 2931 | |
| 2932 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2933 | extern float4 __attribute__((const, overloadable)) |
| 2934 | native_cosh(float4 v); |
| 2935 | #endif |
| 2936 | |
| 2937 | /* |
| 2938 | * native_cospi: Approximate cosine of a number multiplied by pi |
| 2939 | * |
| 2940 | * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians. |
| 2941 | * |
| 2942 | * To get the cosine of a value measured in degrees, call cospi(v / 180.f). |
| 2943 | * |
| 2944 | * See also cospi(). |
| 2945 | */ |
| 2946 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2947 | extern float __attribute__((const, overloadable)) |
| 2948 | native_cospi(float v); |
| 2949 | #endif |
| 2950 | |
| 2951 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2952 | extern float2 __attribute__((const, overloadable)) |
| 2953 | native_cospi(float2 v); |
| 2954 | #endif |
| 2955 | |
| 2956 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2957 | extern float3 __attribute__((const, overloadable)) |
| 2958 | native_cospi(float3 v); |
| 2959 | #endif |
| 2960 | |
| 2961 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2962 | extern float4 __attribute__((const, overloadable)) |
| 2963 | native_cospi(float4 v); |
| 2964 | #endif |
| 2965 | |
| 2966 | /* |
| 2967 | * native_divide: Approximate division |
| 2968 | * |
| 2969 | * Computes the approximate division of two values. |
| 2970 | */ |
| 2971 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2972 | extern float __attribute__((const, overloadable)) |
| 2973 | native_divide(float left_vector, float right_vector); |
| 2974 | #endif |
| 2975 | |
| 2976 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2977 | extern float2 __attribute__((const, overloadable)) |
| 2978 | native_divide(float2 left_vector, float2 right_vector); |
| 2979 | #endif |
| 2980 | |
| 2981 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2982 | extern float3 __attribute__((const, overloadable)) |
| 2983 | native_divide(float3 left_vector, float3 right_vector); |
| 2984 | #endif |
| 2985 | |
| 2986 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2987 | extern float4 __attribute__((const, overloadable)) |
| 2988 | native_divide(float4 left_vector, float4 right_vector); |
| 2989 | #endif |
| 2990 | |
| 2991 | /* |
| 2992 | * native_exp: Approximate e raised to a number |
| 2993 | * |
| 2994 | * Fast approximate exp. |
| 2995 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2996 | * It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be |
| 2997 | * expected from using 16 bit floating point values. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2998 | * |
| 2999 | * See also exp(). |
| 3000 | */ |
| 3001 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3002 | extern float __attribute__((const, overloadable)) |
| 3003 | native_exp(float v); |
| 3004 | #endif |
| 3005 | |
| 3006 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3007 | extern float2 __attribute__((const, overloadable)) |
| 3008 | native_exp(float2 v); |
| 3009 | #endif |
| 3010 | |
| 3011 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3012 | extern float3 __attribute__((const, overloadable)) |
| 3013 | native_exp(float3 v); |
| 3014 | #endif |
| 3015 | |
| 3016 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3017 | extern float4 __attribute__((const, overloadable)) |
| 3018 | native_exp(float4 v); |
| 3019 | #endif |
| 3020 | |
| 3021 | /* |
| 3022 | * native_exp10: Approximate 10 raised to a number |
| 3023 | * |
| 3024 | * Fast approximate exp10. |
| 3025 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3026 | * It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be |
| 3027 | * expected from using 16 bit floating point values. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3028 | * |
| 3029 | * See also exp10(). |
| 3030 | */ |
| 3031 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3032 | extern float __attribute__((const, overloadable)) |
| 3033 | native_exp10(float v); |
| 3034 | #endif |
| 3035 | |
| 3036 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3037 | extern float2 __attribute__((const, overloadable)) |
| 3038 | native_exp10(float2 v); |
| 3039 | #endif |
| 3040 | |
| 3041 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3042 | extern float3 __attribute__((const, overloadable)) |
| 3043 | native_exp10(float3 v); |
| 3044 | #endif |
| 3045 | |
| 3046 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3047 | extern float4 __attribute__((const, overloadable)) |
| 3048 | native_exp10(float4 v); |
| 3049 | #endif |
| 3050 | |
| 3051 | /* |
| 3052 | * native_exp2: Approximate 2 raised to a number |
| 3053 | * |
| 3054 | * Fast approximate exp2. |
| 3055 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3056 | * It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be |
| 3057 | * expected from using 16 bit floating point values. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3058 | * |
| 3059 | * See also exp2(). |
| 3060 | */ |
| 3061 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3062 | extern float __attribute__((const, overloadable)) |
| 3063 | native_exp2(float v); |
| 3064 | #endif |
| 3065 | |
| 3066 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3067 | extern float2 __attribute__((const, overloadable)) |
| 3068 | native_exp2(float2 v); |
| 3069 | #endif |
| 3070 | |
| 3071 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3072 | extern float3 __attribute__((const, overloadable)) |
| 3073 | native_exp2(float3 v); |
| 3074 | #endif |
| 3075 | |
| 3076 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3077 | extern float4 __attribute__((const, overloadable)) |
| 3078 | native_exp2(float4 v); |
| 3079 | #endif |
| 3080 | |
| 3081 | /* |
| 3082 | * native_expm1: Approximate e raised to a number minus one |
| 3083 | * |
| 3084 | * Returns the approximate (e ^ v) - 1. |
| 3085 | * |
| 3086 | * See also expm1(). |
| 3087 | */ |
| 3088 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3089 | extern float __attribute__((const, overloadable)) |
| 3090 | native_expm1(float v); |
| 3091 | #endif |
| 3092 | |
| 3093 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3094 | extern float2 __attribute__((const, overloadable)) |
| 3095 | native_expm1(float2 v); |
| 3096 | #endif |
| 3097 | |
| 3098 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3099 | extern float3 __attribute__((const, overloadable)) |
| 3100 | native_expm1(float3 v); |
| 3101 | #endif |
| 3102 | |
| 3103 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3104 | extern float4 __attribute__((const, overloadable)) |
| 3105 | native_expm1(float4 v); |
| 3106 | #endif |
| 3107 | |
| 3108 | /* |
| 3109 | * native_hypot: Approximate hypotenuse |
| 3110 | * |
| 3111 | * Returns the approximate native_sqrt(a * a + b * b) |
| 3112 | * |
| 3113 | * See also hypot(). |
| 3114 | */ |
| 3115 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3116 | extern float __attribute__((const, overloadable)) |
| 3117 | native_hypot(float a, float b); |
| 3118 | #endif |
| 3119 | |
| 3120 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3121 | extern float2 __attribute__((const, overloadable)) |
| 3122 | native_hypot(float2 a, float2 b); |
| 3123 | #endif |
| 3124 | |
| 3125 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3126 | extern float3 __attribute__((const, overloadable)) |
| 3127 | native_hypot(float3 a, float3 b); |
| 3128 | #endif |
| 3129 | |
| 3130 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3131 | extern float4 __attribute__((const, overloadable)) |
| 3132 | native_hypot(float4 a, float4 b); |
| 3133 | #endif |
| 3134 | |
| 3135 | /* |
| 3136 | * native_log: Approximate natural logarithm |
| 3137 | * |
| 3138 | * Fast approximate log. |
| 3139 | * |
| 3140 | * It is not accurate for values very close to zero. |
| 3141 | * |
| 3142 | * See also log(). |
| 3143 | */ |
| 3144 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3145 | extern float __attribute__((const, overloadable)) |
| 3146 | native_log(float v); |
| 3147 | #endif |
| 3148 | |
| 3149 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3150 | extern float2 __attribute__((const, overloadable)) |
| 3151 | native_log(float2 v); |
| 3152 | #endif |
| 3153 | |
| 3154 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3155 | extern float3 __attribute__((const, overloadable)) |
| 3156 | native_log(float3 v); |
| 3157 | #endif |
| 3158 | |
| 3159 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3160 | extern float4 __attribute__((const, overloadable)) |
| 3161 | native_log(float4 v); |
| 3162 | #endif |
| 3163 | |
| 3164 | /* |
| 3165 | * native_log10: Approximate base 10 logarithm |
| 3166 | * |
| 3167 | * Fast approximate log10. |
| 3168 | * |
| 3169 | * It is not accurate for values very close to zero. |
| 3170 | * |
| 3171 | * See also log10(). |
| 3172 | */ |
| 3173 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3174 | extern float __attribute__((const, overloadable)) |
| 3175 | native_log10(float v); |
| 3176 | #endif |
| 3177 | |
| 3178 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3179 | extern float2 __attribute__((const, overloadable)) |
| 3180 | native_log10(float2 v); |
| 3181 | #endif |
| 3182 | |
| 3183 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3184 | extern float3 __attribute__((const, overloadable)) |
| 3185 | native_log10(float3 v); |
| 3186 | #endif |
| 3187 | |
| 3188 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3189 | extern float4 __attribute__((const, overloadable)) |
| 3190 | native_log10(float4 v); |
| 3191 | #endif |
| 3192 | |
| 3193 | /* |
| 3194 | * native_log1p: Approximate natural logarithm of a value plus 1 |
| 3195 | * |
| 3196 | * Returns the approximate natural logarithm of (v + 1.0f) |
| 3197 | * |
| 3198 | * See also log1p(). |
| 3199 | */ |
| 3200 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3201 | extern float __attribute__((const, overloadable)) |
| 3202 | native_log1p(float v); |
| 3203 | #endif |
| 3204 | |
| 3205 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3206 | extern float2 __attribute__((const, overloadable)) |
| 3207 | native_log1p(float2 v); |
| 3208 | #endif |
| 3209 | |
| 3210 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3211 | extern float3 __attribute__((const, overloadable)) |
| 3212 | native_log1p(float3 v); |
| 3213 | #endif |
| 3214 | |
| 3215 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3216 | extern float4 __attribute__((const, overloadable)) |
| 3217 | native_log1p(float4 v); |
| 3218 | #endif |
| 3219 | |
| 3220 | /* |
| 3221 | * native_log2: Approximate base 2 logarithm |
| 3222 | * |
| 3223 | * Fast approximate log2. |
| 3224 | * |
| 3225 | * It is not accurate for values very close to zero. |
| 3226 | * |
| 3227 | * See also log2(). |
| 3228 | */ |
| 3229 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3230 | extern float __attribute__((const, overloadable)) |
| 3231 | native_log2(float v); |
| 3232 | #endif |
| 3233 | |
| 3234 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3235 | extern float2 __attribute__((const, overloadable)) |
| 3236 | native_log2(float2 v); |
| 3237 | #endif |
| 3238 | |
| 3239 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3240 | extern float3 __attribute__((const, overloadable)) |
| 3241 | native_log2(float3 v); |
| 3242 | #endif |
| 3243 | |
| 3244 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3245 | extern float4 __attribute__((const, overloadable)) |
| 3246 | native_log2(float4 v); |
| 3247 | #endif |
| 3248 | |
| 3249 | /* |
| 3250 | * native_powr: Approximate positive base raised to an exponent |
| 3251 | * |
| 3252 | * Fast approximate (base ^ exponent). |
| 3253 | * |
| 3254 | * See also powr(). |
| 3255 | * |
| 3256 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 3257 | * base: Must be between 0.f and 256.f. The function is not accurate for values very close to zero. |
| 3258 | * exponent: Must be between -15.f and 15.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3259 | */ |
| 3260 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3261 | extern float __attribute__((const, overloadable)) |
| 3262 | native_powr(float base, float exponent); |
| 3263 | #endif |
| 3264 | |
| 3265 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3266 | extern float2 __attribute__((const, overloadable)) |
| 3267 | native_powr(float2 base, float2 exponent); |
| 3268 | #endif |
| 3269 | |
| 3270 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3271 | extern float3 __attribute__((const, overloadable)) |
| 3272 | native_powr(float3 base, float3 exponent); |
| 3273 | #endif |
| 3274 | |
| 3275 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 3276 | extern float4 __attribute__((const, overloadable)) |
| 3277 | native_powr(float4 base, float4 exponent); |
| 3278 | #endif |
| 3279 | |
| 3280 | /* |
| 3281 | * native_recip: Approximate reciprocal |
| 3282 | * |
| 3283 | * Returns the approximate approximate reciprocal of a value. |
| 3284 | * |
| 3285 | * See also half_recip(). |
| 3286 | */ |
| 3287 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3288 | extern float __attribute__((const, overloadable)) |
| 3289 | native_recip(float v); |
| 3290 | #endif |
| 3291 | |
| 3292 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3293 | extern float2 __attribute__((const, overloadable)) |
| 3294 | native_recip(float2 v); |
| 3295 | #endif |
| 3296 | |
| 3297 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3298 | extern float3 __attribute__((const, overloadable)) |
| 3299 | native_recip(float3 v); |
| 3300 | #endif |
| 3301 | |
| 3302 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3303 | extern float4 __attribute__((const, overloadable)) |
| 3304 | native_recip(float4 v); |
| 3305 | #endif |
| 3306 | |
| 3307 | /* |
| 3308 | * native_rootn: Approximate nth root |
| 3309 | * |
| 3310 | * Compute the approximate Nth root of a value. |
| 3311 | * |
| 3312 | * See also rootn(). |
| 3313 | */ |
| 3314 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3315 | extern float __attribute__((const, overloadable)) |
| 3316 | native_rootn(float v, int n); |
| 3317 | #endif |
| 3318 | |
| 3319 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3320 | extern float2 __attribute__((const, overloadable)) |
| 3321 | native_rootn(float2 v, int2 n); |
| 3322 | #endif |
| 3323 | |
| 3324 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3325 | extern float3 __attribute__((const, overloadable)) |
| 3326 | native_rootn(float3 v, int3 n); |
| 3327 | #endif |
| 3328 | |
| 3329 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3330 | extern float4 __attribute__((const, overloadable)) |
| 3331 | native_rootn(float4 v, int4 n); |
| 3332 | #endif |
| 3333 | |
| 3334 | /* |
| 3335 | * native_rsqrt: Approximate reciprocal of a square root |
| 3336 | * |
| 3337 | * Returns approximate (1 / sqrt(v)). |
| 3338 | * |
| 3339 | * See also rsqrt(), half_rsqrt(). |
| 3340 | */ |
| 3341 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3342 | extern float __attribute__((const, overloadable)) |
| 3343 | native_rsqrt(float v); |
| 3344 | #endif |
| 3345 | |
| 3346 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3347 | extern float2 __attribute__((const, overloadable)) |
| 3348 | native_rsqrt(float2 v); |
| 3349 | #endif |
| 3350 | |
| 3351 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3352 | extern float3 __attribute__((const, overloadable)) |
| 3353 | native_rsqrt(float3 v); |
| 3354 | #endif |
| 3355 | |
| 3356 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3357 | extern float4 __attribute__((const, overloadable)) |
| 3358 | native_rsqrt(float4 v); |
| 3359 | #endif |
| 3360 | |
| 3361 | /* |
| 3362 | * native_sin: Approximate sine |
| 3363 | * |
| 3364 | * Returns the approximate sine of an angle measured in radians. |
| 3365 | * |
| 3366 | * See also sin(). |
| 3367 | */ |
| 3368 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3369 | extern float __attribute__((const, overloadable)) |
| 3370 | native_sin(float v); |
| 3371 | #endif |
| 3372 | |
| 3373 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3374 | extern float2 __attribute__((const, overloadable)) |
| 3375 | native_sin(float2 v); |
| 3376 | #endif |
| 3377 | |
| 3378 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3379 | extern float3 __attribute__((const, overloadable)) |
| 3380 | native_sin(float3 v); |
| 3381 | #endif |
| 3382 | |
| 3383 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3384 | extern float4 __attribute__((const, overloadable)) |
| 3385 | native_sin(float4 v); |
| 3386 | #endif |
| 3387 | |
| 3388 | /* |
| 3389 | * native_sincos: Approximate sine and cosine |
| 3390 | * |
| 3391 | * Returns the approximate sine and cosine of a value. |
| 3392 | * |
| 3393 | * See also sincos(). |
| 3394 | * |
| 3395 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3396 | * v: Incoming value in radians. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 3397 | * cos: *cos will be set to the cosine value. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3398 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3399 | * Returns: Sine. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3400 | */ |
| 3401 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3402 | extern float __attribute__((overloadable)) |
| 3403 | native_sincos(float v, float* cos); |
| 3404 | #endif |
| 3405 | |
| 3406 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3407 | extern float2 __attribute__((overloadable)) |
| 3408 | native_sincos(float2 v, float2* cos); |
| 3409 | #endif |
| 3410 | |
| 3411 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3412 | extern float3 __attribute__((overloadable)) |
| 3413 | native_sincos(float3 v, float3* cos); |
| 3414 | #endif |
| 3415 | |
| 3416 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3417 | extern float4 __attribute__((overloadable)) |
| 3418 | native_sincos(float4 v, float4* cos); |
| 3419 | #endif |
| 3420 | |
| 3421 | /* |
| 3422 | * native_sinh: Approximate hyperbolic sine |
| 3423 | * |
| 3424 | * Returns the approximate hyperbolic sine of a value specified in radians. |
| 3425 | * |
| 3426 | * See also sinh(). |
| 3427 | */ |
| 3428 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3429 | extern float __attribute__((const, overloadable)) |
| 3430 | native_sinh(float v); |
| 3431 | #endif |
| 3432 | |
| 3433 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3434 | extern float2 __attribute__((const, overloadable)) |
| 3435 | native_sinh(float2 v); |
| 3436 | #endif |
| 3437 | |
| 3438 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3439 | extern float3 __attribute__((const, overloadable)) |
| 3440 | native_sinh(float3 v); |
| 3441 | #endif |
| 3442 | |
| 3443 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3444 | extern float4 __attribute__((const, overloadable)) |
| 3445 | native_sinh(float4 v); |
| 3446 | #endif |
| 3447 | |
| 3448 | /* |
| 3449 | * native_sinpi: Approximate sine of a number multiplied by pi |
| 3450 | * |
| 3451 | * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians. |
| 3452 | * |
| 3453 | * To get the sine of a value measured in degrees, call sinpi(v / 180.f). |
| 3454 | * |
| 3455 | * See also sinpi(). |
| 3456 | */ |
| 3457 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3458 | extern float __attribute__((const, overloadable)) |
| 3459 | native_sinpi(float v); |
| 3460 | #endif |
| 3461 | |
| 3462 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3463 | extern float2 __attribute__((const, overloadable)) |
| 3464 | native_sinpi(float2 v); |
| 3465 | #endif |
| 3466 | |
| 3467 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3468 | extern float3 __attribute__((const, overloadable)) |
| 3469 | native_sinpi(float3 v); |
| 3470 | #endif |
| 3471 | |
| 3472 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3473 | extern float4 __attribute__((const, overloadable)) |
| 3474 | native_sinpi(float4 v); |
| 3475 | #endif |
| 3476 | |
| 3477 | /* |
| 3478 | * native_sqrt: Approximate square root |
| 3479 | * |
| 3480 | * Returns the approximate sqrt(v). |
| 3481 | * |
| 3482 | * See also sqrt(), half_sqrt(). |
| 3483 | */ |
| 3484 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3485 | extern float __attribute__((const, overloadable)) |
| 3486 | native_sqrt(float v); |
| 3487 | #endif |
| 3488 | |
| 3489 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3490 | extern float2 __attribute__((const, overloadable)) |
| 3491 | native_sqrt(float2 v); |
| 3492 | #endif |
| 3493 | |
| 3494 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3495 | extern float3 __attribute__((const, overloadable)) |
| 3496 | native_sqrt(float3 v); |
| 3497 | #endif |
| 3498 | |
| 3499 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3500 | extern float4 __attribute__((const, overloadable)) |
| 3501 | native_sqrt(float4 v); |
| 3502 | #endif |
| 3503 | |
| 3504 | /* |
| 3505 | * native_tan: Approximate tangent |
| 3506 | * |
| 3507 | * Returns the approximate tangent of an angle measured in radians. |
| 3508 | */ |
| 3509 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3510 | extern float __attribute__((const, overloadable)) |
| 3511 | native_tan(float v); |
| 3512 | #endif |
| 3513 | |
| 3514 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3515 | extern float2 __attribute__((const, overloadable)) |
| 3516 | native_tan(float2 v); |
| 3517 | #endif |
| 3518 | |
| 3519 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3520 | extern float3 __attribute__((const, overloadable)) |
| 3521 | native_tan(float3 v); |
| 3522 | #endif |
| 3523 | |
| 3524 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3525 | extern float4 __attribute__((const, overloadable)) |
| 3526 | native_tan(float4 v); |
| 3527 | #endif |
| 3528 | |
| 3529 | /* |
| 3530 | * native_tanh: Approximate hyperbolic tangent |
| 3531 | * |
| 3532 | * Returns the approximate hyperbolic tangent of a value. |
| 3533 | * |
| 3534 | * See also tanh(). |
| 3535 | */ |
| 3536 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3537 | extern float __attribute__((const, overloadable)) |
| 3538 | native_tanh(float v); |
| 3539 | #endif |
| 3540 | |
| 3541 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3542 | extern float2 __attribute__((const, overloadable)) |
| 3543 | native_tanh(float2 v); |
| 3544 | #endif |
| 3545 | |
| 3546 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3547 | extern float3 __attribute__((const, overloadable)) |
| 3548 | native_tanh(float3 v); |
| 3549 | #endif |
| 3550 | |
| 3551 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3552 | extern float4 __attribute__((const, overloadable)) |
| 3553 | native_tanh(float4 v); |
| 3554 | #endif |
| 3555 | |
| 3556 | /* |
| 3557 | * native_tanpi: Approximate tangent of a number multiplied by pi |
| 3558 | * |
| 3559 | * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians. |
| 3560 | * |
| 3561 | * To get the tangent of a value measured in degrees, call tanpi(v / 180.f). |
| 3562 | * |
| 3563 | * See also tanpi(). |
| 3564 | */ |
| 3565 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3566 | extern float __attribute__((const, overloadable)) |
| 3567 | native_tanpi(float v); |
| 3568 | #endif |
| 3569 | |
| 3570 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3571 | extern float2 __attribute__((const, overloadable)) |
| 3572 | native_tanpi(float2 v); |
| 3573 | #endif |
| 3574 | |
| 3575 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3576 | extern float3 __attribute__((const, overloadable)) |
| 3577 | native_tanpi(float3 v); |
| 3578 | #endif |
| 3579 | |
| 3580 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3581 | extern float4 __attribute__((const, overloadable)) |
| 3582 | native_tanpi(float4 v); |
| 3583 | #endif |
| 3584 | |
| 3585 | /* |
| 3586 | * nextafter: Next floating point number |
| 3587 | * |
| 3588 | * Returns the next representable floating point number from v towards target. |
| 3589 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3590 | * In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized |
| 3591 | * value, as support of denormalized values is optional in relaxed mode. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3592 | */ |
| 3593 | extern float __attribute__((const, overloadable)) |
| 3594 | nextafter(float v, float target); |
| 3595 | |
| 3596 | extern float2 __attribute__((const, overloadable)) |
| 3597 | nextafter(float2 v, float2 target); |
| 3598 | |
| 3599 | extern float3 __attribute__((const, overloadable)) |
| 3600 | nextafter(float3 v, float3 target); |
| 3601 | |
| 3602 | extern float4 __attribute__((const, overloadable)) |
| 3603 | nextafter(float4 v, float4 target); |
| 3604 | |
| 3605 | /* |
| 3606 | * pow: Base raised to an exponent |
| 3607 | * |
| 3608 | * Returns base raised to the power exponent, i.e. base ^ exponent. |
| 3609 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3610 | * pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the |
| 3611 | * base to be non-negative. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3612 | */ |
| 3613 | extern float __attribute__((const, overloadable)) |
| 3614 | pow(float base, float exponent); |
| 3615 | |
| 3616 | extern float2 __attribute__((const, overloadable)) |
| 3617 | pow(float2 base, float2 exponent); |
| 3618 | |
| 3619 | extern float3 __attribute__((const, overloadable)) |
| 3620 | pow(float3 base, float3 exponent); |
| 3621 | |
| 3622 | extern float4 __attribute__((const, overloadable)) |
| 3623 | pow(float4 base, float4 exponent); |
| 3624 | |
| 3625 | /* |
| 3626 | * pown: Base raised to an integer exponent |
| 3627 | * |
| 3628 | * Returns base raised to the power exponent, i.e. base ^ exponent. |
| 3629 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3630 | * pow() and powr() are similar. The both take a float exponent. powr() also assumes the |
| 3631 | * base to be non-negative. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3632 | */ |
| 3633 | extern float __attribute__((const, overloadable)) |
| 3634 | pown(float base, int exponent); |
| 3635 | |
| 3636 | extern float2 __attribute__((const, overloadable)) |
| 3637 | pown(float2 base, int2 exponent); |
| 3638 | |
| 3639 | extern float3 __attribute__((const, overloadable)) |
| 3640 | pown(float3 base, int3 exponent); |
| 3641 | |
| 3642 | extern float4 __attribute__((const, overloadable)) |
| 3643 | pown(float4 base, int4 exponent); |
| 3644 | |
| 3645 | /* |
| 3646 | * powr: Positive base raised to an exponent |
| 3647 | * |
| 3648 | * Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0. |
| 3649 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3650 | * pow() and pown() are similar. They both make no assumptions about the base. |
| 3651 | * pow() takes a float exponent while pown() take an integer. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3652 | * |
| 3653 | * See also native_powr(). |
| 3654 | */ |
| 3655 | extern float __attribute__((const, overloadable)) |
| 3656 | powr(float base, float exponent); |
| 3657 | |
| 3658 | extern float2 __attribute__((const, overloadable)) |
| 3659 | powr(float2 base, float2 exponent); |
| 3660 | |
| 3661 | extern float3 __attribute__((const, overloadable)) |
| 3662 | powr(float3 base, float3 exponent); |
| 3663 | |
| 3664 | extern float4 __attribute__((const, overloadable)) |
| 3665 | powr(float4 base, float4 exponent); |
| 3666 | |
| 3667 | /* |
| 3668 | * radians: Converts degrees into radians |
| 3669 | * |
| 3670 | * Converts from degrees to radians. |
| 3671 | */ |
| 3672 | extern float __attribute__((const, overloadable)) |
| 3673 | radians(float v); |
| 3674 | |
| 3675 | extern float2 __attribute__((const, overloadable)) |
| 3676 | radians(float2 v); |
| 3677 | |
| 3678 | extern float3 __attribute__((const, overloadable)) |
| 3679 | radians(float3 v); |
| 3680 | |
| 3681 | extern float4 __attribute__((const, overloadable)) |
| 3682 | radians(float4 v); |
| 3683 | |
| 3684 | /* |
| 3685 | * remainder: Remainder of a division |
| 3686 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3687 | * Returns the remainder of (numerator / denominator), where the quotient is rounded towards |
| 3688 | * the nearest integer. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3689 | * |
| 3690 | * The function fmod() is similar but rounds toward the closest interger. |
| 3691 | * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f) |
| 3692 | * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f). |
| 3693 | */ |
| 3694 | extern float __attribute__((const, overloadable)) |
| 3695 | remainder(float numerator, float denominator); |
| 3696 | |
| 3697 | extern float2 __attribute__((const, overloadable)) |
| 3698 | remainder(float2 numerator, float2 denominator); |
| 3699 | |
| 3700 | extern float3 __attribute__((const, overloadable)) |
| 3701 | remainder(float3 numerator, float3 denominator); |
| 3702 | |
| 3703 | extern float4 __attribute__((const, overloadable)) |
| 3704 | remainder(float4 numerator, float4 denominator); |
| 3705 | |
| 3706 | /* |
| 3707 | * remquo: Remainder and quotient of a division |
| 3708 | * |
| 3709 | * Returns the quotient and the remainder of (numerator / denominator). |
| 3710 | * |
| 3711 | * Only the sign and lowest three bits of the quotient are guaranteed to be accurate. |
| 3712 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3713 | * This function is useful for implementing periodic functions. The low three bits of the |
| 3714 | * quotient gives the quadrant and the remainder the distance within the quadrant. |
| 3715 | * For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) |
| 3716 | * to reduce very large value of x to something within a limited range. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3717 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3718 | * Example: remquo(-23.5f, 8.f, ") sets the lowest three bits of quot to 3 |
| 3719 | * and the sign negative. It returns 0.5f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3720 | * |
| 3721 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3722 | * numerator: Numerator. |
| 3723 | * denominator: Denominator. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 3724 | * quotient: *quotient will be set to the integer quotient. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3725 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3726 | * Returns: Remainder, precise only for the low three bits. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3727 | */ |
| 3728 | extern float __attribute__((overloadable)) |
| 3729 | remquo(float numerator, float denominator, int* quotient); |
| 3730 | |
| 3731 | extern float2 __attribute__((overloadable)) |
| 3732 | remquo(float2 numerator, float2 denominator, int2* quotient); |
| 3733 | |
| 3734 | extern float3 __attribute__((overloadable)) |
| 3735 | remquo(float3 numerator, float3 denominator, int3* quotient); |
| 3736 | |
| 3737 | extern float4 __attribute__((overloadable)) |
| 3738 | remquo(float4 numerator, float4 denominator, int4* quotient); |
| 3739 | |
| 3740 | /* |
| 3741 | * rint: Round to even |
| 3742 | * |
| 3743 | * Rounds to the nearest integral value. |
| 3744 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3745 | * rint() rounds half values to even. For example, rint(0.5f) returns 0.f and |
| 3746 | * rint(1.5f) returns 2.f. Similarly, rint(-0.5f) returns -0.f and |
| 3747 | * rint(-1.5f) returns -2.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3748 | * |
| 3749 | * round() is similar but rounds away from zero. trunc() truncates the decimal fraction. |
| 3750 | */ |
| 3751 | extern float __attribute__((const, overloadable)) |
| 3752 | rint(float v); |
| 3753 | |
| 3754 | extern float2 __attribute__((const, overloadable)) |
| 3755 | rint(float2 v); |
| 3756 | |
| 3757 | extern float3 __attribute__((const, overloadable)) |
| 3758 | rint(float3 v); |
| 3759 | |
| 3760 | extern float4 __attribute__((const, overloadable)) |
| 3761 | rint(float4 v); |
| 3762 | |
| 3763 | /* |
| 3764 | * rootn: Nth root |
| 3765 | * |
| 3766 | * Compute the Nth root of a value. |
| 3767 | * |
| 3768 | * See also native_rootn(). |
| 3769 | */ |
| 3770 | extern float __attribute__((const, overloadable)) |
| 3771 | rootn(float v, int n); |
| 3772 | |
| 3773 | extern float2 __attribute__((const, overloadable)) |
| 3774 | rootn(float2 v, int2 n); |
| 3775 | |
| 3776 | extern float3 __attribute__((const, overloadable)) |
| 3777 | rootn(float3 v, int3 n); |
| 3778 | |
| 3779 | extern float4 __attribute__((const, overloadable)) |
| 3780 | rootn(float4 v, int4 n); |
| 3781 | |
| 3782 | /* |
| 3783 | * round: Round away from zero |
| 3784 | * |
| 3785 | * Round to the nearest integral value. |
| 3786 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3787 | * round() rounds half values away from zero. For example, round(0.5f) returns 1.f |
| 3788 | * and round(1.5f) returns 2.f. Similarly, round(-0.5f) returns -1.f |
| 3789 | * and round(-1.5f) returns -2.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3790 | * |
| 3791 | * rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction. |
| 3792 | */ |
| 3793 | extern float __attribute__((const, overloadable)) |
| 3794 | round(float v); |
| 3795 | |
| 3796 | extern float2 __attribute__((const, overloadable)) |
| 3797 | round(float2 v); |
| 3798 | |
| 3799 | extern float3 __attribute__((const, overloadable)) |
| 3800 | round(float3 v); |
| 3801 | |
| 3802 | extern float4 __attribute__((const, overloadable)) |
| 3803 | round(float4 v); |
| 3804 | |
| 3805 | /* |
| 3806 | * rsqrt: Reciprocal of a square root |
| 3807 | * |
| 3808 | * Returns (1 / sqrt(v)). |
| 3809 | * |
| 3810 | * See also half_rsqrt(), native_rsqrt(). |
| 3811 | */ |
| 3812 | extern float __attribute__((const, overloadable)) |
| 3813 | rsqrt(float v); |
| 3814 | |
| 3815 | extern float2 __attribute__((const, overloadable)) |
| 3816 | rsqrt(float2 v); |
| 3817 | |
| 3818 | extern float3 __attribute__((const, overloadable)) |
| 3819 | rsqrt(float3 v); |
| 3820 | |
| 3821 | extern float4 __attribute__((const, overloadable)) |
| 3822 | rsqrt(float4 v); |
| 3823 | |
| 3824 | /* |
| 3825 | * sign: Sign of a value |
| 3826 | * |
| 3827 | * Returns the sign of a value. |
| 3828 | * |
| 3829 | * if (v < 0) return -1.f; |
| 3830 | * else if (v > 0) return 1.f; |
| 3831 | * else return 0.f; |
| 3832 | */ |
| 3833 | extern float __attribute__((const, overloadable)) |
| 3834 | sign(float v); |
| 3835 | |
| 3836 | extern float2 __attribute__((const, overloadable)) |
| 3837 | sign(float2 v); |
| 3838 | |
| 3839 | extern float3 __attribute__((const, overloadable)) |
| 3840 | sign(float3 v); |
| 3841 | |
| 3842 | extern float4 __attribute__((const, overloadable)) |
| 3843 | sign(float4 v); |
| 3844 | |
| 3845 | /* |
| 3846 | * sin: Sine |
| 3847 | * |
| 3848 | * Returns the sine of an angle measured in radians. |
| 3849 | * |
| 3850 | * See also native_sin(). |
| 3851 | */ |
| 3852 | extern float __attribute__((const, overloadable)) |
| 3853 | sin(float v); |
| 3854 | |
| 3855 | extern float2 __attribute__((const, overloadable)) |
| 3856 | sin(float2 v); |
| 3857 | |
| 3858 | extern float3 __attribute__((const, overloadable)) |
| 3859 | sin(float3 v); |
| 3860 | |
| 3861 | extern float4 __attribute__((const, overloadable)) |
| 3862 | sin(float4 v); |
| 3863 | |
| 3864 | /* |
| 3865 | * sincos: Sine and cosine |
| 3866 | * |
| 3867 | * Returns the sine and cosine of a value. |
| 3868 | * |
| 3869 | * See also native_sincos(). |
| 3870 | * |
| 3871 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3872 | * v: Incoming value in radians. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 3873 | * cos: *cos will be set to the cosine value. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3874 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3875 | * Returns: Sine of v. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3876 | */ |
| 3877 | extern float __attribute__((overloadable)) |
| 3878 | sincos(float v, float* cos); |
| 3879 | |
| 3880 | extern float2 __attribute__((overloadable)) |
| 3881 | sincos(float2 v, float2* cos); |
| 3882 | |
| 3883 | extern float3 __attribute__((overloadable)) |
| 3884 | sincos(float3 v, float3* cos); |
| 3885 | |
| 3886 | extern float4 __attribute__((overloadable)) |
| 3887 | sincos(float4 v, float4* cos); |
| 3888 | |
| 3889 | /* |
| 3890 | * sinh: Hyperbolic sine |
| 3891 | * |
| 3892 | * Returns the hyperbolic sine of v, where v is measured in radians. |
| 3893 | * |
| 3894 | * See also native_sinh(). |
| 3895 | */ |
| 3896 | extern float __attribute__((const, overloadable)) |
| 3897 | sinh(float v); |
| 3898 | |
| 3899 | extern float2 __attribute__((const, overloadable)) |
| 3900 | sinh(float2 v); |
| 3901 | |
| 3902 | extern float3 __attribute__((const, overloadable)) |
| 3903 | sinh(float3 v); |
| 3904 | |
| 3905 | extern float4 __attribute__((const, overloadable)) |
| 3906 | sinh(float4 v); |
| 3907 | |
| 3908 | /* |
| 3909 | * sinpi: Sine of a number multiplied by pi |
| 3910 | * |
| 3911 | * Returns the sine of (v * pi), where (v * pi) is measured in radians. |
| 3912 | * |
| 3913 | * To get the sine of a value measured in degrees, call sinpi(v / 180.f). |
| 3914 | * |
| 3915 | * See also native_sinpi(). |
| 3916 | */ |
| 3917 | extern float __attribute__((const, overloadable)) |
| 3918 | sinpi(float v); |
| 3919 | |
| 3920 | extern float2 __attribute__((const, overloadable)) |
| 3921 | sinpi(float2 v); |
| 3922 | |
| 3923 | extern float3 __attribute__((const, overloadable)) |
| 3924 | sinpi(float3 v); |
| 3925 | |
| 3926 | extern float4 __attribute__((const, overloadable)) |
| 3927 | sinpi(float4 v); |
| 3928 | |
| 3929 | /* |
| 3930 | * sqrt: Square root |
| 3931 | * |
| 3932 | * Returns the square root of a value. |
| 3933 | * |
| 3934 | * See also half_sqrt(), native_sqrt(). |
| 3935 | */ |
| 3936 | extern float __attribute__((const, overloadable)) |
| 3937 | sqrt(float v); |
| 3938 | |
| 3939 | extern float2 __attribute__((const, overloadable)) |
| 3940 | sqrt(float2 v); |
| 3941 | |
| 3942 | extern float3 __attribute__((const, overloadable)) |
| 3943 | sqrt(float3 v); |
| 3944 | |
| 3945 | extern float4 __attribute__((const, overloadable)) |
| 3946 | sqrt(float4 v); |
| 3947 | |
| 3948 | /* |
| 3949 | * step: 0 if less than a value, 0 otherwise |
| 3950 | * |
| 3951 | * Returns 0.f if v < edge, 1.f otherwise. |
| 3952 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3953 | * This can be useful to create conditional computations without using loops and branching |
| 3954 | * instructions. For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) |
| 3955 | * for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b). |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3956 | */ |
| 3957 | extern float __attribute__((const, overloadable)) |
| 3958 | step(float edge, float v); |
| 3959 | |
| 3960 | extern float2 __attribute__((const, overloadable)) |
| 3961 | step(float2 edge, float2 v); |
| 3962 | |
| 3963 | extern float3 __attribute__((const, overloadable)) |
| 3964 | step(float3 edge, float3 v); |
| 3965 | |
| 3966 | extern float4 __attribute__((const, overloadable)) |
| 3967 | step(float4 edge, float4 v); |
| 3968 | |
| 3969 | extern float2 __attribute__((const, overloadable)) |
| 3970 | step(float2 edge, float v); |
| 3971 | |
| 3972 | extern float3 __attribute__((const, overloadable)) |
| 3973 | step(float3 edge, float v); |
| 3974 | |
| 3975 | extern float4 __attribute__((const, overloadable)) |
| 3976 | step(float4 edge, float v); |
| 3977 | |
| 3978 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3979 | extern float2 __attribute__((const, overloadable)) |
| 3980 | step(float edge, float2 v); |
| 3981 | #endif |
| 3982 | |
| 3983 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3984 | extern float3 __attribute__((const, overloadable)) |
| 3985 | step(float edge, float3 v); |
| 3986 | #endif |
| 3987 | |
| 3988 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3989 | extern float4 __attribute__((const, overloadable)) |
| 3990 | step(float edge, float4 v); |
| 3991 | #endif |
| 3992 | |
| 3993 | /* |
| 3994 | * tan: Tangent |
| 3995 | * |
| 3996 | * Returns the tangent of an angle measured in radians. |
| 3997 | * |
| 3998 | * See also native_tan(). |
| 3999 | */ |
| 4000 | extern float __attribute__((const, overloadable)) |
| 4001 | tan(float v); |
| 4002 | |
| 4003 | extern float2 __attribute__((const, overloadable)) |
| 4004 | tan(float2 v); |
| 4005 | |
| 4006 | extern float3 __attribute__((const, overloadable)) |
| 4007 | tan(float3 v); |
| 4008 | |
| 4009 | extern float4 __attribute__((const, overloadable)) |
| 4010 | tan(float4 v); |
| 4011 | |
| 4012 | /* |
| 4013 | * tanh: Hyperbolic tangent |
| 4014 | * |
| 4015 | * Returns the hyperbolic tangent of a value. |
| 4016 | * |
| 4017 | * See also native_tanh(). |
| 4018 | */ |
| 4019 | extern float __attribute__((const, overloadable)) |
| 4020 | tanh(float v); |
| 4021 | |
| 4022 | extern float2 __attribute__((const, overloadable)) |
| 4023 | tanh(float2 v); |
| 4024 | |
| 4025 | extern float3 __attribute__((const, overloadable)) |
| 4026 | tanh(float3 v); |
| 4027 | |
| 4028 | extern float4 __attribute__((const, overloadable)) |
| 4029 | tanh(float4 v); |
| 4030 | |
| 4031 | /* |
| 4032 | * tanpi: Tangent of a number multiplied by pi |
| 4033 | * |
| 4034 | * Returns the tangent of (v * pi), where (v * pi) is measured in radians. |
| 4035 | * |
| 4036 | * To get the tangent of a value measured in degrees, call tanpi(v / 180.f). |
| 4037 | * |
| 4038 | * See also native_tanpi(). |
| 4039 | */ |
| 4040 | extern float __attribute__((const, overloadable)) |
| 4041 | tanpi(float v); |
| 4042 | |
| 4043 | extern float2 __attribute__((const, overloadable)) |
| 4044 | tanpi(float2 v); |
| 4045 | |
| 4046 | extern float3 __attribute__((const, overloadable)) |
| 4047 | tanpi(float3 v); |
| 4048 | |
| 4049 | extern float4 __attribute__((const, overloadable)) |
| 4050 | tanpi(float4 v); |
| 4051 | |
| 4052 | /* |
| 4053 | * tgamma: Gamma function |
| 4054 | * |
| 4055 | * Returns the gamma function of a value. |
| 4056 | * |
| 4057 | * See also lgamma(). |
| 4058 | */ |
| 4059 | extern float __attribute__((const, overloadable)) |
| 4060 | tgamma(float v); |
| 4061 | |
| 4062 | extern float2 __attribute__((const, overloadable)) |
| 4063 | tgamma(float2 v); |
| 4064 | |
| 4065 | extern float3 __attribute__((const, overloadable)) |
| 4066 | tgamma(float3 v); |
| 4067 | |
| 4068 | extern float4 __attribute__((const, overloadable)) |
| 4069 | tgamma(float4 v); |
| 4070 | |
| 4071 | /* |
| 4072 | * trunc: Truncates a floating point |
| 4073 | * |
| 4074 | * Rounds to integral using truncation. |
| 4075 | * |
| 4076 | * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f. |
| 4077 | * |
| 4078 | * See rint() and round() for other rounding options. |
| 4079 | */ |
| 4080 | extern float __attribute__((const, overloadable)) |
| 4081 | trunc(float v); |
| 4082 | |
| 4083 | extern float2 __attribute__((const, overloadable)) |
| 4084 | trunc(float2 v); |
| 4085 | |
| 4086 | extern float3 __attribute__((const, overloadable)) |
| 4087 | trunc(float3 v); |
| 4088 | |
| 4089 | extern float4 __attribute__((const, overloadable)) |
| 4090 | trunc(float4 v); |
| 4091 | |
| 4092 | /* |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4093 | * rsClamp: Restrain a value to a range |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 4094 | * |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 4095 | * DEPRECATED. Do not use. |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 4096 | * |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 4097 | * Clamp a value between low and high. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4098 | * |
| 4099 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 4100 | * amount: Value to clamp. |
| 4101 | * low: Lower bound. |
| 4102 | * high: Upper bound. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 4103 | */ |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4104 | extern char __attribute__((const, always_inline, overloadable |
| 4105 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4106 | , deprecated("Use clamp() instead.") |
| 4107 | #endif |
| 4108 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4109 | rsClamp(char amount, char low, char high); |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 4110 | |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4111 | extern uchar __attribute__((const, always_inline, overloadable |
| 4112 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4113 | , deprecated("Use clamp() instead.") |
| 4114 | #endif |
| 4115 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4116 | rsClamp(uchar amount, uchar low, uchar high); |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 4117 | |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4118 | extern short __attribute__((const, always_inline, overloadable |
| 4119 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4120 | , deprecated("Use clamp() instead.") |
| 4121 | #endif |
| 4122 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4123 | rsClamp(short amount, short low, short high); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 4124 | |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4125 | extern ushort __attribute__((const, always_inline, overloadable |
| 4126 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4127 | , deprecated("Use clamp() instead.") |
| 4128 | #endif |
| 4129 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4130 | rsClamp(ushort amount, ushort low, ushort high); |
| 4131 | |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4132 | extern int __attribute__((const, always_inline, overloadable |
| 4133 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4134 | , deprecated("Use clamp() instead.") |
| 4135 | #endif |
| 4136 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4137 | rsClamp(int amount, int low, int high); |
| 4138 | |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4139 | extern uint __attribute__((const, always_inline, overloadable |
| 4140 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4141 | , deprecated("Use clamp() instead.") |
| 4142 | #endif |
| 4143 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4144 | rsClamp(uint amount, uint low, uint high); |
| 4145 | |
| 4146 | /* |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 4147 | * rsFrac: Returns the fractional part of a float |
| 4148 | * |
| 4149 | * DEPRECATED. Do not use. |
| 4150 | * |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4151 | * Returns the fractional part of a float |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 4152 | */ |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 4153 | extern float __attribute__((const, overloadable |
| 4154 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 4155 | , deprecated("Use fract() instead.") |
| 4156 | #endif |
| 4157 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4158 | rsFrac(float v); |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 4159 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4160 | /* |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 4161 | * rsRand: Pseudo-random number |
| 4162 | * |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4163 | * Return a random value between 0 (or min_value) and max_malue. |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 4164 | */ |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4165 | extern int __attribute__((overloadable)) |
| 4166 | rsRand(int max_value); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 4167 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4168 | extern int __attribute__((overloadable)) |
| 4169 | rsRand(int min_value, int max_value); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 4170 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4171 | extern float __attribute__((overloadable)) |
| 4172 | rsRand(float max_value); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 4173 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4174 | extern float __attribute__((overloadable)) |
| 4175 | rsRand(float min_value, float max_value); |
| 4176 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 4177 | #endif // RENDERSCRIPT_RS_MATH_RSH |