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 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 218 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 219 | extern half __attribute__((const, overloadable)) |
| 220 | acos(half v); |
| 221 | #endif |
| 222 | |
| 223 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 224 | extern half2 __attribute__((const, overloadable)) |
| 225 | acos(half2 v); |
| 226 | #endif |
| 227 | |
| 228 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 229 | extern half3 __attribute__((const, overloadable)) |
| 230 | acos(half3 v); |
| 231 | #endif |
| 232 | |
| 233 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 234 | extern half4 __attribute__((const, overloadable)) |
| 235 | acos(half4 v); |
| 236 | #endif |
| 237 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 238 | /* |
| 239 | * acosh: Inverse hyperbolic cosine |
| 240 | * |
| 241 | * Returns the inverse hyperbolic cosine, in radians. |
| 242 | * |
| 243 | * See also native_acosh(). |
| 244 | */ |
| 245 | extern float __attribute__((const, overloadable)) |
| 246 | acosh(float v); |
| 247 | |
| 248 | extern float2 __attribute__((const, overloadable)) |
| 249 | acosh(float2 v); |
| 250 | |
| 251 | extern float3 __attribute__((const, overloadable)) |
| 252 | acosh(float3 v); |
| 253 | |
| 254 | extern float4 __attribute__((const, overloadable)) |
| 255 | acosh(float4 v); |
| 256 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 257 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 258 | extern half __attribute__((const, overloadable)) |
| 259 | acosh(half v); |
| 260 | #endif |
| 261 | |
| 262 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 263 | extern half2 __attribute__((const, overloadable)) |
| 264 | acosh(half2 v); |
| 265 | #endif |
| 266 | |
| 267 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 268 | extern half3 __attribute__((const, overloadable)) |
| 269 | acosh(half3 v); |
| 270 | #endif |
| 271 | |
| 272 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 273 | extern half4 __attribute__((const, overloadable)) |
| 274 | acosh(half4 v); |
| 275 | #endif |
| 276 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 277 | /* |
| 278 | * acospi: Inverse cosine divided by pi |
| 279 | * |
| 280 | * Returns the inverse cosine in radians, divided by pi. |
| 281 | * |
| 282 | * To get an inverse cosine measured in degrees, use acospi(a) * 180.f. |
| 283 | * |
| 284 | * See also native_acospi(). |
| 285 | */ |
| 286 | extern float __attribute__((const, overloadable)) |
| 287 | acospi(float v); |
| 288 | |
| 289 | extern float2 __attribute__((const, overloadable)) |
| 290 | acospi(float2 v); |
| 291 | |
| 292 | extern float3 __attribute__((const, overloadable)) |
| 293 | acospi(float3 v); |
| 294 | |
| 295 | extern float4 __attribute__((const, overloadable)) |
| 296 | acospi(float4 v); |
| 297 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 298 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 299 | extern half __attribute__((const, overloadable)) |
| 300 | acospi(half v); |
| 301 | #endif |
| 302 | |
| 303 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 304 | extern half2 __attribute__((const, overloadable)) |
| 305 | acospi(half2 v); |
| 306 | #endif |
| 307 | |
| 308 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 309 | extern half3 __attribute__((const, overloadable)) |
| 310 | acospi(half3 v); |
| 311 | #endif |
| 312 | |
| 313 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 314 | extern half4 __attribute__((const, overloadable)) |
| 315 | acospi(half4 v); |
| 316 | #endif |
| 317 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 318 | /* |
| 319 | * asin: Inverse sine |
| 320 | * |
| 321 | * Returns the inverse sine, in radians. |
| 322 | * |
| 323 | * See also native_asin(). |
| 324 | */ |
| 325 | extern float __attribute__((const, overloadable)) |
| 326 | asin(float v); |
| 327 | |
| 328 | extern float2 __attribute__((const, overloadable)) |
| 329 | asin(float2 v); |
| 330 | |
| 331 | extern float3 __attribute__((const, overloadable)) |
| 332 | asin(float3 v); |
| 333 | |
| 334 | extern float4 __attribute__((const, overloadable)) |
| 335 | asin(float4 v); |
| 336 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 337 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 338 | extern half __attribute__((const, overloadable)) |
| 339 | asin(half v); |
| 340 | #endif |
| 341 | |
| 342 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 343 | extern half2 __attribute__((const, overloadable)) |
| 344 | asin(half2 v); |
| 345 | #endif |
| 346 | |
| 347 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 348 | extern half3 __attribute__((const, overloadable)) |
| 349 | asin(half3 v); |
| 350 | #endif |
| 351 | |
| 352 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 353 | extern half4 __attribute__((const, overloadable)) |
| 354 | asin(half4 v); |
| 355 | #endif |
| 356 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 357 | /* |
| 358 | * asinh: Inverse hyperbolic sine |
| 359 | * |
| 360 | * Returns the inverse hyperbolic sine, in radians. |
| 361 | * |
| 362 | * See also native_asinh(). |
| 363 | */ |
| 364 | extern float __attribute__((const, overloadable)) |
| 365 | asinh(float v); |
| 366 | |
| 367 | extern float2 __attribute__((const, overloadable)) |
| 368 | asinh(float2 v); |
| 369 | |
| 370 | extern float3 __attribute__((const, overloadable)) |
| 371 | asinh(float3 v); |
| 372 | |
| 373 | extern float4 __attribute__((const, overloadable)) |
| 374 | asinh(float4 v); |
| 375 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 376 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 377 | extern half __attribute__((const, overloadable)) |
| 378 | asinh(half v); |
| 379 | #endif |
| 380 | |
| 381 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 382 | extern half2 __attribute__((const, overloadable)) |
| 383 | asinh(half2 v); |
| 384 | #endif |
| 385 | |
| 386 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 387 | extern half3 __attribute__((const, overloadable)) |
| 388 | asinh(half3 v); |
| 389 | #endif |
| 390 | |
| 391 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 392 | extern half4 __attribute__((const, overloadable)) |
| 393 | asinh(half4 v); |
| 394 | #endif |
| 395 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 396 | /* |
| 397 | * asinpi: Inverse sine divided by pi |
| 398 | * |
| 399 | * Returns the inverse sine in radians, divided by pi. |
| 400 | * |
| 401 | * To get an inverse sine measured in degrees, use asinpi(a) * 180.f. |
| 402 | * |
| 403 | * See also native_asinpi(). |
| 404 | */ |
| 405 | extern float __attribute__((const, overloadable)) |
| 406 | asinpi(float v); |
| 407 | |
| 408 | extern float2 __attribute__((const, overloadable)) |
| 409 | asinpi(float2 v); |
| 410 | |
| 411 | extern float3 __attribute__((const, overloadable)) |
| 412 | asinpi(float3 v); |
| 413 | |
| 414 | extern float4 __attribute__((const, overloadable)) |
| 415 | asinpi(float4 v); |
| 416 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 417 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 418 | extern half __attribute__((const, overloadable)) |
| 419 | asinpi(half v); |
| 420 | #endif |
| 421 | |
| 422 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 423 | extern half2 __attribute__((const, overloadable)) |
| 424 | asinpi(half2 v); |
| 425 | #endif |
| 426 | |
| 427 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 428 | extern half3 __attribute__((const, overloadable)) |
| 429 | asinpi(half3 v); |
| 430 | #endif |
| 431 | |
| 432 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 433 | extern half4 __attribute__((const, overloadable)) |
| 434 | asinpi(half4 v); |
| 435 | #endif |
| 436 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 437 | /* |
| 438 | * atan: Inverse tangent |
| 439 | * |
| 440 | * Returns the inverse tangent, in radians. |
| 441 | * |
| 442 | * See also native_atan(). |
| 443 | */ |
| 444 | extern float __attribute__((const, overloadable)) |
| 445 | atan(float v); |
| 446 | |
| 447 | extern float2 __attribute__((const, overloadable)) |
| 448 | atan(float2 v); |
| 449 | |
| 450 | extern float3 __attribute__((const, overloadable)) |
| 451 | atan(float3 v); |
| 452 | |
| 453 | extern float4 __attribute__((const, overloadable)) |
| 454 | atan(float4 v); |
| 455 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 456 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 457 | extern half __attribute__((const, overloadable)) |
| 458 | atan(half v); |
| 459 | #endif |
| 460 | |
| 461 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 462 | extern half2 __attribute__((const, overloadable)) |
| 463 | atan(half2 v); |
| 464 | #endif |
| 465 | |
| 466 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 467 | extern half3 __attribute__((const, overloadable)) |
| 468 | atan(half3 v); |
| 469 | #endif |
| 470 | |
| 471 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 472 | extern half4 __attribute__((const, overloadable)) |
| 473 | atan(half4 v); |
| 474 | #endif |
| 475 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 476 | /* |
| 477 | * atan2: Inverse tangent of a ratio |
| 478 | * |
| 479 | * Returns the inverse tangent of (numerator / denominator), in radians. |
| 480 | * |
| 481 | * See also native_atan2(). |
| 482 | * |
| 483 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 484 | * numerator: Numerator. |
| 485 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 486 | */ |
| 487 | extern float __attribute__((const, overloadable)) |
| 488 | atan2(float numerator, float denominator); |
| 489 | |
| 490 | extern float2 __attribute__((const, overloadable)) |
| 491 | atan2(float2 numerator, float2 denominator); |
| 492 | |
| 493 | extern float3 __attribute__((const, overloadable)) |
| 494 | atan2(float3 numerator, float3 denominator); |
| 495 | |
| 496 | extern float4 __attribute__((const, overloadable)) |
| 497 | atan2(float4 numerator, float4 denominator); |
| 498 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 499 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 500 | extern half __attribute__((const, overloadable)) |
| 501 | atan2(half numerator, half denominator); |
| 502 | #endif |
| 503 | |
| 504 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 505 | extern half2 __attribute__((const, overloadable)) |
| 506 | atan2(half2 numerator, half2 denominator); |
| 507 | #endif |
| 508 | |
| 509 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 510 | extern half3 __attribute__((const, overloadable)) |
| 511 | atan2(half3 numerator, half3 denominator); |
| 512 | #endif |
| 513 | |
| 514 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 515 | extern half4 __attribute__((const, overloadable)) |
| 516 | atan2(half4 numerator, half4 denominator); |
| 517 | #endif |
| 518 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 519 | /* |
| 520 | * atan2pi: Inverse tangent of a ratio, divided by pi |
| 521 | * |
| 522 | * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi. |
| 523 | * |
| 524 | * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f. |
| 525 | * |
| 526 | * See also native_atan2pi(). |
| 527 | * |
| 528 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 529 | * numerator: Numerator. |
| 530 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 531 | */ |
| 532 | extern float __attribute__((const, overloadable)) |
| 533 | atan2pi(float numerator, float denominator); |
| 534 | |
| 535 | extern float2 __attribute__((const, overloadable)) |
| 536 | atan2pi(float2 numerator, float2 denominator); |
| 537 | |
| 538 | extern float3 __attribute__((const, overloadable)) |
| 539 | atan2pi(float3 numerator, float3 denominator); |
| 540 | |
| 541 | extern float4 __attribute__((const, overloadable)) |
| 542 | atan2pi(float4 numerator, float4 denominator); |
| 543 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 544 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 545 | extern half __attribute__((const, overloadable)) |
| 546 | atan2pi(half numerator, half denominator); |
| 547 | #endif |
| 548 | |
| 549 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 550 | extern half2 __attribute__((const, overloadable)) |
| 551 | atan2pi(half2 numerator, half2 denominator); |
| 552 | #endif |
| 553 | |
| 554 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 555 | extern half3 __attribute__((const, overloadable)) |
| 556 | atan2pi(half3 numerator, half3 denominator); |
| 557 | #endif |
| 558 | |
| 559 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 560 | extern half4 __attribute__((const, overloadable)) |
| 561 | atan2pi(half4 numerator, half4 denominator); |
| 562 | #endif |
| 563 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 564 | /* |
| 565 | * atanh: Inverse hyperbolic tangent |
| 566 | * |
| 567 | * Returns the inverse hyperbolic tangent, in radians. |
| 568 | * |
| 569 | * See also native_atanh(). |
| 570 | */ |
| 571 | extern float __attribute__((const, overloadable)) |
| 572 | atanh(float v); |
| 573 | |
| 574 | extern float2 __attribute__((const, overloadable)) |
| 575 | atanh(float2 v); |
| 576 | |
| 577 | extern float3 __attribute__((const, overloadable)) |
| 578 | atanh(float3 v); |
| 579 | |
| 580 | extern float4 __attribute__((const, overloadable)) |
| 581 | atanh(float4 v); |
| 582 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 583 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 584 | extern half __attribute__((const, overloadable)) |
| 585 | atanh(half v); |
| 586 | #endif |
| 587 | |
| 588 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 589 | extern half2 __attribute__((const, overloadable)) |
| 590 | atanh(half2 v); |
| 591 | #endif |
| 592 | |
| 593 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 594 | extern half3 __attribute__((const, overloadable)) |
| 595 | atanh(half3 v); |
| 596 | #endif |
| 597 | |
| 598 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 599 | extern half4 __attribute__((const, overloadable)) |
| 600 | atanh(half4 v); |
| 601 | #endif |
| 602 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 603 | /* |
| 604 | * atanpi: Inverse tangent divided by pi |
| 605 | * |
| 606 | * Returns the inverse tangent in radians, divided by pi. |
| 607 | * |
| 608 | * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f. |
| 609 | * |
| 610 | * See also native_atanpi(). |
| 611 | */ |
| 612 | extern float __attribute__((const, overloadable)) |
| 613 | atanpi(float v); |
| 614 | |
| 615 | extern float2 __attribute__((const, overloadable)) |
| 616 | atanpi(float2 v); |
| 617 | |
| 618 | extern float3 __attribute__((const, overloadable)) |
| 619 | atanpi(float3 v); |
| 620 | |
| 621 | extern float4 __attribute__((const, overloadable)) |
| 622 | atanpi(float4 v); |
| 623 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 624 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 625 | extern half __attribute__((const, overloadable)) |
| 626 | atanpi(half v); |
| 627 | #endif |
| 628 | |
| 629 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 630 | extern half2 __attribute__((const, overloadable)) |
| 631 | atanpi(half2 v); |
| 632 | #endif |
| 633 | |
| 634 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 635 | extern half3 __attribute__((const, overloadable)) |
| 636 | atanpi(half3 v); |
| 637 | #endif |
| 638 | |
| 639 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 640 | extern half4 __attribute__((const, overloadable)) |
| 641 | atanpi(half4 v); |
| 642 | #endif |
| 643 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 644 | /* |
| 645 | * cbrt: Cube root |
| 646 | * |
| 647 | * Returns the cube root. |
| 648 | * |
| 649 | * See also native_cbrt(). |
| 650 | */ |
| 651 | extern float __attribute__((const, overloadable)) |
| 652 | cbrt(float v); |
| 653 | |
| 654 | extern float2 __attribute__((const, overloadable)) |
| 655 | cbrt(float2 v); |
| 656 | |
| 657 | extern float3 __attribute__((const, overloadable)) |
| 658 | cbrt(float3 v); |
| 659 | |
| 660 | extern float4 __attribute__((const, overloadable)) |
| 661 | cbrt(float4 v); |
| 662 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 663 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 664 | extern half __attribute__((const, overloadable)) |
| 665 | cbrt(half v); |
| 666 | #endif |
| 667 | |
| 668 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 669 | extern half2 __attribute__((const, overloadable)) |
| 670 | cbrt(half2 v); |
| 671 | #endif |
| 672 | |
| 673 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 674 | extern half3 __attribute__((const, overloadable)) |
| 675 | cbrt(half3 v); |
| 676 | #endif |
| 677 | |
| 678 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 679 | extern half4 __attribute__((const, overloadable)) |
| 680 | cbrt(half4 v); |
| 681 | #endif |
| 682 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 683 | /* |
| 684 | * ceil: Smallest integer not less than a value |
| 685 | * |
| 686 | * Returns the smallest integer not less than a value. |
| 687 | * |
| 688 | * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f. |
| 689 | * |
| 690 | * See also floor(). |
| 691 | */ |
| 692 | extern float __attribute__((const, overloadable)) |
| 693 | ceil(float v); |
| 694 | |
| 695 | extern float2 __attribute__((const, overloadable)) |
| 696 | ceil(float2 v); |
| 697 | |
| 698 | extern float3 __attribute__((const, overloadable)) |
| 699 | ceil(float3 v); |
| 700 | |
| 701 | extern float4 __attribute__((const, overloadable)) |
| 702 | ceil(float4 v); |
| 703 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 704 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 705 | extern half __attribute__((const, overloadable)) |
| 706 | ceil(half v); |
| 707 | #endif |
| 708 | |
| 709 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 710 | extern half2 __attribute__((const, overloadable)) |
| 711 | ceil(half2 v); |
| 712 | #endif |
| 713 | |
| 714 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 715 | extern half3 __attribute__((const, overloadable)) |
| 716 | ceil(half3 v); |
| 717 | #endif |
| 718 | |
| 719 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 720 | extern half4 __attribute__((const, overloadable)) |
| 721 | ceil(half4 v); |
| 722 | #endif |
| 723 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 724 | /* |
| 725 | * clamp: Restrain a value to a range |
| 726 | * |
| 727 | * Clamps a value to a specified high and low bound. clamp() returns min_value |
| 728 | * if value < min_value, max_value if value > max_value, otherwise value. |
| 729 | * |
| 730 | * There are two variants of clamp: one where the min and max are scalars applied |
| 731 | * to all entries of the value, the other where the min and max are also vectors. |
| 732 | * |
| 733 | * If min_value is greater than max_value, the results are undefined. |
| 734 | * |
| 735 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 736 | * value: Value to be clamped. |
| 737 | * min_value: Lower bound, a scalar or matching vector. |
| 738 | * max_value: High bound, must match the type of low. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 739 | */ |
| 740 | extern float __attribute__((const, overloadable)) |
| 741 | clamp(float value, float min_value, float max_value); |
| 742 | |
| 743 | extern float2 __attribute__((const, overloadable)) |
| 744 | clamp(float2 value, float2 min_value, float2 max_value); |
| 745 | |
| 746 | extern float3 __attribute__((const, overloadable)) |
| 747 | clamp(float3 value, float3 min_value, float3 max_value); |
| 748 | |
| 749 | extern float4 __attribute__((const, overloadable)) |
| 750 | clamp(float4 value, float4 min_value, float4 max_value); |
| 751 | |
| 752 | extern float2 __attribute__((const, overloadable)) |
| 753 | clamp(float2 value, float min_value, float max_value); |
| 754 | |
| 755 | extern float3 __attribute__((const, overloadable)) |
| 756 | clamp(float3 value, float min_value, float max_value); |
| 757 | |
| 758 | extern float4 __attribute__((const, overloadable)) |
| 759 | clamp(float4 value, float min_value, float max_value); |
| 760 | |
| 761 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 762 | extern char __attribute__((const, overloadable)) |
| 763 | clamp(char value, char min_value, char max_value); |
| 764 | #endif |
| 765 | |
| 766 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 767 | extern char2 __attribute__((const, overloadable)) |
| 768 | clamp(char2 value, char2 min_value, char2 max_value); |
| 769 | #endif |
| 770 | |
| 771 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 772 | extern char3 __attribute__((const, overloadable)) |
| 773 | clamp(char3 value, char3 min_value, char3 max_value); |
| 774 | #endif |
| 775 | |
| 776 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 777 | extern char4 __attribute__((const, overloadable)) |
| 778 | clamp(char4 value, char4 min_value, char4 max_value); |
| 779 | #endif |
| 780 | |
| 781 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 782 | extern uchar __attribute__((const, overloadable)) |
| 783 | clamp(uchar value, uchar min_value, uchar max_value); |
| 784 | #endif |
| 785 | |
| 786 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 787 | extern uchar2 __attribute__((const, overloadable)) |
| 788 | clamp(uchar2 value, uchar2 min_value, uchar2 max_value); |
| 789 | #endif |
| 790 | |
| 791 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 792 | extern uchar3 __attribute__((const, overloadable)) |
| 793 | clamp(uchar3 value, uchar3 min_value, uchar3 max_value); |
| 794 | #endif |
| 795 | |
| 796 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 797 | extern uchar4 __attribute__((const, overloadable)) |
| 798 | clamp(uchar4 value, uchar4 min_value, uchar4 max_value); |
| 799 | #endif |
| 800 | |
| 801 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 802 | extern short __attribute__((const, overloadable)) |
| 803 | clamp(short value, short min_value, short max_value); |
| 804 | #endif |
| 805 | |
| 806 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 807 | extern short2 __attribute__((const, overloadable)) |
| 808 | clamp(short2 value, short2 min_value, short2 max_value); |
| 809 | #endif |
| 810 | |
| 811 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 812 | extern short3 __attribute__((const, overloadable)) |
| 813 | clamp(short3 value, short3 min_value, short3 max_value); |
| 814 | #endif |
| 815 | |
| 816 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 817 | extern short4 __attribute__((const, overloadable)) |
| 818 | clamp(short4 value, short4 min_value, short4 max_value); |
| 819 | #endif |
| 820 | |
| 821 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 822 | extern ushort __attribute__((const, overloadable)) |
| 823 | clamp(ushort value, ushort min_value, ushort max_value); |
| 824 | #endif |
| 825 | |
| 826 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 827 | extern ushort2 __attribute__((const, overloadable)) |
| 828 | clamp(ushort2 value, ushort2 min_value, ushort2 max_value); |
| 829 | #endif |
| 830 | |
| 831 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 832 | extern ushort3 __attribute__((const, overloadable)) |
| 833 | clamp(ushort3 value, ushort3 min_value, ushort3 max_value); |
| 834 | #endif |
| 835 | |
| 836 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 837 | extern ushort4 __attribute__((const, overloadable)) |
| 838 | clamp(ushort4 value, ushort4 min_value, ushort4 max_value); |
| 839 | #endif |
| 840 | |
| 841 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 842 | extern int __attribute__((const, overloadable)) |
| 843 | clamp(int value, int min_value, int max_value); |
| 844 | #endif |
| 845 | |
| 846 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 847 | extern int2 __attribute__((const, overloadable)) |
| 848 | clamp(int2 value, int2 min_value, int2 max_value); |
| 849 | #endif |
| 850 | |
| 851 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 852 | extern int3 __attribute__((const, overloadable)) |
| 853 | clamp(int3 value, int3 min_value, int3 max_value); |
| 854 | #endif |
| 855 | |
| 856 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 857 | extern int4 __attribute__((const, overloadable)) |
| 858 | clamp(int4 value, int4 min_value, int4 max_value); |
| 859 | #endif |
| 860 | |
| 861 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 862 | extern uint __attribute__((const, overloadable)) |
| 863 | clamp(uint value, uint min_value, uint max_value); |
| 864 | #endif |
| 865 | |
| 866 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 867 | extern uint2 __attribute__((const, overloadable)) |
| 868 | clamp(uint2 value, uint2 min_value, uint2 max_value); |
| 869 | #endif |
| 870 | |
| 871 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 872 | extern uint3 __attribute__((const, overloadable)) |
| 873 | clamp(uint3 value, uint3 min_value, uint3 max_value); |
| 874 | #endif |
| 875 | |
| 876 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 877 | extern uint4 __attribute__((const, overloadable)) |
| 878 | clamp(uint4 value, uint4 min_value, uint4 max_value); |
| 879 | #endif |
| 880 | |
| 881 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 882 | extern long __attribute__((const, overloadable)) |
| 883 | clamp(long value, long min_value, long max_value); |
| 884 | #endif |
| 885 | |
| 886 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 887 | extern long2 __attribute__((const, overloadable)) |
| 888 | clamp(long2 value, long2 min_value, long2 max_value); |
| 889 | #endif |
| 890 | |
| 891 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 892 | extern long3 __attribute__((const, overloadable)) |
| 893 | clamp(long3 value, long3 min_value, long3 max_value); |
| 894 | #endif |
| 895 | |
| 896 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 897 | extern long4 __attribute__((const, overloadable)) |
| 898 | clamp(long4 value, long4 min_value, long4 max_value); |
| 899 | #endif |
| 900 | |
| 901 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 902 | extern ulong __attribute__((const, overloadable)) |
| 903 | clamp(ulong value, ulong min_value, ulong max_value); |
| 904 | #endif |
| 905 | |
| 906 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 907 | extern ulong2 __attribute__((const, overloadable)) |
| 908 | clamp(ulong2 value, ulong2 min_value, ulong2 max_value); |
| 909 | #endif |
| 910 | |
| 911 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 912 | extern ulong3 __attribute__((const, overloadable)) |
| 913 | clamp(ulong3 value, ulong3 min_value, ulong3 max_value); |
| 914 | #endif |
| 915 | |
| 916 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 917 | extern ulong4 __attribute__((const, overloadable)) |
| 918 | clamp(ulong4 value, ulong4 min_value, ulong4 max_value); |
| 919 | #endif |
| 920 | |
| 921 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 922 | extern char2 __attribute__((const, overloadable)) |
| 923 | clamp(char2 value, char min_value, char max_value); |
| 924 | #endif |
| 925 | |
| 926 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 927 | extern char3 __attribute__((const, overloadable)) |
| 928 | clamp(char3 value, char min_value, char max_value); |
| 929 | #endif |
| 930 | |
| 931 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 932 | extern char4 __attribute__((const, overloadable)) |
| 933 | clamp(char4 value, char min_value, char max_value); |
| 934 | #endif |
| 935 | |
| 936 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 937 | extern uchar2 __attribute__((const, overloadable)) |
| 938 | clamp(uchar2 value, uchar min_value, uchar max_value); |
| 939 | #endif |
| 940 | |
| 941 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 942 | extern uchar3 __attribute__((const, overloadable)) |
| 943 | clamp(uchar3 value, uchar min_value, uchar max_value); |
| 944 | #endif |
| 945 | |
| 946 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 947 | extern uchar4 __attribute__((const, overloadable)) |
| 948 | clamp(uchar4 value, uchar min_value, uchar max_value); |
| 949 | #endif |
| 950 | |
| 951 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 952 | extern short2 __attribute__((const, overloadable)) |
| 953 | clamp(short2 value, short min_value, short max_value); |
| 954 | #endif |
| 955 | |
| 956 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 957 | extern short3 __attribute__((const, overloadable)) |
| 958 | clamp(short3 value, short min_value, short max_value); |
| 959 | #endif |
| 960 | |
| 961 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 962 | extern short4 __attribute__((const, overloadable)) |
| 963 | clamp(short4 value, short min_value, short max_value); |
| 964 | #endif |
| 965 | |
| 966 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 967 | extern ushort2 __attribute__((const, overloadable)) |
| 968 | clamp(ushort2 value, ushort min_value, ushort max_value); |
| 969 | #endif |
| 970 | |
| 971 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 972 | extern ushort3 __attribute__((const, overloadable)) |
| 973 | clamp(ushort3 value, ushort min_value, ushort max_value); |
| 974 | #endif |
| 975 | |
| 976 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 977 | extern ushort4 __attribute__((const, overloadable)) |
| 978 | clamp(ushort4 value, ushort min_value, ushort max_value); |
| 979 | #endif |
| 980 | |
| 981 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 982 | extern int2 __attribute__((const, overloadable)) |
| 983 | clamp(int2 value, int min_value, int max_value); |
| 984 | #endif |
| 985 | |
| 986 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 987 | extern int3 __attribute__((const, overloadable)) |
| 988 | clamp(int3 value, int min_value, int max_value); |
| 989 | #endif |
| 990 | |
| 991 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 992 | extern int4 __attribute__((const, overloadable)) |
| 993 | clamp(int4 value, int min_value, int max_value); |
| 994 | #endif |
| 995 | |
| 996 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 997 | extern uint2 __attribute__((const, overloadable)) |
| 998 | clamp(uint2 value, uint min_value, uint max_value); |
| 999 | #endif |
| 1000 | |
| 1001 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1002 | extern uint3 __attribute__((const, overloadable)) |
| 1003 | clamp(uint3 value, uint min_value, uint max_value); |
| 1004 | #endif |
| 1005 | |
| 1006 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1007 | extern uint4 __attribute__((const, overloadable)) |
| 1008 | clamp(uint4 value, uint min_value, uint max_value); |
| 1009 | #endif |
| 1010 | |
| 1011 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1012 | extern long2 __attribute__((const, overloadable)) |
| 1013 | clamp(long2 value, long min_value, long max_value); |
| 1014 | #endif |
| 1015 | |
| 1016 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1017 | extern long3 __attribute__((const, overloadable)) |
| 1018 | clamp(long3 value, long min_value, long max_value); |
| 1019 | #endif |
| 1020 | |
| 1021 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1022 | extern long4 __attribute__((const, overloadable)) |
| 1023 | clamp(long4 value, long min_value, long max_value); |
| 1024 | #endif |
| 1025 | |
| 1026 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1027 | extern ulong2 __attribute__((const, overloadable)) |
| 1028 | clamp(ulong2 value, ulong min_value, ulong max_value); |
| 1029 | #endif |
| 1030 | |
| 1031 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1032 | extern ulong3 __attribute__((const, overloadable)) |
| 1033 | clamp(ulong3 value, ulong min_value, ulong max_value); |
| 1034 | #endif |
| 1035 | |
| 1036 | #if (defined(RS_VERSION) && (RS_VERSION >= 19)) |
| 1037 | extern ulong4 __attribute__((const, overloadable)) |
| 1038 | clamp(ulong4 value, ulong min_value, ulong max_value); |
| 1039 | #endif |
| 1040 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1041 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1042 | extern half __attribute__((const, overloadable)) |
| 1043 | clamp(half value, half min_value, half max_value); |
| 1044 | #endif |
| 1045 | |
| 1046 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1047 | extern half2 __attribute__((const, overloadable)) |
| 1048 | clamp(half2 value, half2 min_value, half2 max_value); |
| 1049 | #endif |
| 1050 | |
| 1051 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1052 | extern half3 __attribute__((const, overloadable)) |
| 1053 | clamp(half3 value, half3 min_value, half3 max_value); |
| 1054 | #endif |
| 1055 | |
| 1056 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1057 | extern half4 __attribute__((const, overloadable)) |
| 1058 | clamp(half4 value, half4 min_value, half4 max_value); |
| 1059 | #endif |
| 1060 | |
| 1061 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1062 | extern half2 __attribute__((const, overloadable)) |
| 1063 | clamp(half2 value, half min_value, half max_value); |
| 1064 | #endif |
| 1065 | |
| 1066 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1067 | extern half3 __attribute__((const, overloadable)) |
| 1068 | clamp(half3 value, half min_value, half max_value); |
| 1069 | #endif |
| 1070 | |
| 1071 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1072 | extern half4 __attribute__((const, overloadable)) |
| 1073 | clamp(half4 value, half min_value, half max_value); |
| 1074 | #endif |
| 1075 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1076 | /* |
| 1077 | * clz: Number of leading 0 bits |
| 1078 | * |
| 1079 | * Returns the number of leading 0-bits in a value. |
| 1080 | * |
| 1081 | * For example, clz((char)0x03) returns 6. |
| 1082 | */ |
| 1083 | extern char __attribute__((const, overloadable)) |
| 1084 | clz(char value); |
| 1085 | |
| 1086 | extern char2 __attribute__((const, overloadable)) |
| 1087 | clz(char2 value); |
| 1088 | |
| 1089 | extern char3 __attribute__((const, overloadable)) |
| 1090 | clz(char3 value); |
| 1091 | |
| 1092 | extern char4 __attribute__((const, overloadable)) |
| 1093 | clz(char4 value); |
| 1094 | |
| 1095 | extern uchar __attribute__((const, overloadable)) |
| 1096 | clz(uchar value); |
| 1097 | |
| 1098 | extern uchar2 __attribute__((const, overloadable)) |
| 1099 | clz(uchar2 value); |
| 1100 | |
| 1101 | extern uchar3 __attribute__((const, overloadable)) |
| 1102 | clz(uchar3 value); |
| 1103 | |
| 1104 | extern uchar4 __attribute__((const, overloadable)) |
| 1105 | clz(uchar4 value); |
| 1106 | |
| 1107 | extern short __attribute__((const, overloadable)) |
| 1108 | clz(short value); |
| 1109 | |
| 1110 | extern short2 __attribute__((const, overloadable)) |
| 1111 | clz(short2 value); |
| 1112 | |
| 1113 | extern short3 __attribute__((const, overloadable)) |
| 1114 | clz(short3 value); |
| 1115 | |
| 1116 | extern short4 __attribute__((const, overloadable)) |
| 1117 | clz(short4 value); |
| 1118 | |
| 1119 | extern ushort __attribute__((const, overloadable)) |
| 1120 | clz(ushort value); |
| 1121 | |
| 1122 | extern ushort2 __attribute__((const, overloadable)) |
| 1123 | clz(ushort2 value); |
| 1124 | |
| 1125 | extern ushort3 __attribute__((const, overloadable)) |
| 1126 | clz(ushort3 value); |
| 1127 | |
| 1128 | extern ushort4 __attribute__((const, overloadable)) |
| 1129 | clz(ushort4 value); |
| 1130 | |
| 1131 | extern int __attribute__((const, overloadable)) |
| 1132 | clz(int value); |
| 1133 | |
| 1134 | extern int2 __attribute__((const, overloadable)) |
| 1135 | clz(int2 value); |
| 1136 | |
| 1137 | extern int3 __attribute__((const, overloadable)) |
| 1138 | clz(int3 value); |
| 1139 | |
| 1140 | extern int4 __attribute__((const, overloadable)) |
| 1141 | clz(int4 value); |
| 1142 | |
| 1143 | extern uint __attribute__((const, overloadable)) |
| 1144 | clz(uint value); |
| 1145 | |
| 1146 | extern uint2 __attribute__((const, overloadable)) |
| 1147 | clz(uint2 value); |
| 1148 | |
| 1149 | extern uint3 __attribute__((const, overloadable)) |
| 1150 | clz(uint3 value); |
| 1151 | |
| 1152 | extern uint4 __attribute__((const, overloadable)) |
| 1153 | clz(uint4 value); |
| 1154 | |
| 1155 | /* |
| 1156 | * copysign: Copies the sign of a number to another |
| 1157 | * |
| 1158 | * Copies the sign from sign_value to magnitude_value. |
| 1159 | * |
| 1160 | * The value returned is either magnitude_value or -magnitude_value. |
| 1161 | * |
| 1162 | * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f. |
| 1163 | */ |
| 1164 | extern float __attribute__((const, overloadable)) |
| 1165 | copysign(float magnitude_value, float sign_value); |
| 1166 | |
| 1167 | extern float2 __attribute__((const, overloadable)) |
| 1168 | copysign(float2 magnitude_value, float2 sign_value); |
| 1169 | |
| 1170 | extern float3 __attribute__((const, overloadable)) |
| 1171 | copysign(float3 magnitude_value, float3 sign_value); |
| 1172 | |
| 1173 | extern float4 __attribute__((const, overloadable)) |
| 1174 | copysign(float4 magnitude_value, float4 sign_value); |
| 1175 | |
| 1176 | /* |
| 1177 | * cos: Cosine |
| 1178 | * |
| 1179 | * Returns the cosine of an angle measured in radians. |
| 1180 | * |
| 1181 | * See also native_cos(). |
| 1182 | */ |
| 1183 | extern float __attribute__((const, overloadable)) |
| 1184 | cos(float v); |
| 1185 | |
| 1186 | extern float2 __attribute__((const, overloadable)) |
| 1187 | cos(float2 v); |
| 1188 | |
| 1189 | extern float3 __attribute__((const, overloadable)) |
| 1190 | cos(float3 v); |
| 1191 | |
| 1192 | extern float4 __attribute__((const, overloadable)) |
| 1193 | cos(float4 v); |
| 1194 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1195 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1196 | extern half __attribute__((const, overloadable)) |
| 1197 | cos(half v); |
| 1198 | #endif |
| 1199 | |
| 1200 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1201 | extern half2 __attribute__((const, overloadable)) |
| 1202 | cos(half2 v); |
| 1203 | #endif |
| 1204 | |
| 1205 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1206 | extern half3 __attribute__((const, overloadable)) |
| 1207 | cos(half3 v); |
| 1208 | #endif |
| 1209 | |
| 1210 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1211 | extern half4 __attribute__((const, overloadable)) |
| 1212 | cos(half4 v); |
| 1213 | #endif |
| 1214 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1215 | /* |
| 1216 | * cosh: Hypebolic cosine |
| 1217 | * |
| 1218 | * Returns the hypebolic cosine of v, where v is measured in radians. |
| 1219 | * |
| 1220 | * See also native_cosh(). |
| 1221 | */ |
| 1222 | extern float __attribute__((const, overloadable)) |
| 1223 | cosh(float v); |
| 1224 | |
| 1225 | extern float2 __attribute__((const, overloadable)) |
| 1226 | cosh(float2 v); |
| 1227 | |
| 1228 | extern float3 __attribute__((const, overloadable)) |
| 1229 | cosh(float3 v); |
| 1230 | |
| 1231 | extern float4 __attribute__((const, overloadable)) |
| 1232 | cosh(float4 v); |
| 1233 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1234 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1235 | extern half __attribute__((const, overloadable)) |
| 1236 | cosh(half v); |
| 1237 | #endif |
| 1238 | |
| 1239 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1240 | extern half2 __attribute__((const, overloadable)) |
| 1241 | cosh(half2 v); |
| 1242 | #endif |
| 1243 | |
| 1244 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1245 | extern half3 __attribute__((const, overloadable)) |
| 1246 | cosh(half3 v); |
| 1247 | #endif |
| 1248 | |
| 1249 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1250 | extern half4 __attribute__((const, overloadable)) |
| 1251 | cosh(half4 v); |
| 1252 | #endif |
| 1253 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1254 | /* |
| 1255 | * cospi: Cosine of a number multiplied by pi |
| 1256 | * |
| 1257 | * Returns the cosine of (v * pi), where (v * pi) is measured in radians. |
| 1258 | * |
| 1259 | * To get the cosine of a value measured in degrees, call cospi(v / 180.f). |
| 1260 | * |
| 1261 | * See also native_cospi(). |
| 1262 | */ |
| 1263 | extern float __attribute__((const, overloadable)) |
| 1264 | cospi(float v); |
| 1265 | |
| 1266 | extern float2 __attribute__((const, overloadable)) |
| 1267 | cospi(float2 v); |
| 1268 | |
| 1269 | extern float3 __attribute__((const, overloadable)) |
| 1270 | cospi(float3 v); |
| 1271 | |
| 1272 | extern float4 __attribute__((const, overloadable)) |
| 1273 | cospi(float4 v); |
| 1274 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1275 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1276 | extern half __attribute__((const, overloadable)) |
| 1277 | cospi(half v); |
| 1278 | #endif |
| 1279 | |
| 1280 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1281 | extern half2 __attribute__((const, overloadable)) |
| 1282 | cospi(half2 v); |
| 1283 | #endif |
| 1284 | |
| 1285 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1286 | extern half3 __attribute__((const, overloadable)) |
| 1287 | cospi(half3 v); |
| 1288 | #endif |
| 1289 | |
| 1290 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1291 | extern half4 __attribute__((const, overloadable)) |
| 1292 | cospi(half4 v); |
| 1293 | #endif |
| 1294 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1295 | /* |
| 1296 | * degrees: Converts radians into degrees |
| 1297 | * |
| 1298 | * Converts from radians to degrees. |
| 1299 | */ |
| 1300 | extern float __attribute__((const, overloadable)) |
| 1301 | degrees(float v); |
| 1302 | |
| 1303 | extern float2 __attribute__((const, overloadable)) |
| 1304 | degrees(float2 v); |
| 1305 | |
| 1306 | extern float3 __attribute__((const, overloadable)) |
| 1307 | degrees(float3 v); |
| 1308 | |
| 1309 | extern float4 __attribute__((const, overloadable)) |
| 1310 | degrees(float4 v); |
| 1311 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1312 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1313 | extern half __attribute__((const, overloadable)) |
| 1314 | degrees(half v); |
| 1315 | #endif |
| 1316 | |
| 1317 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1318 | extern half2 __attribute__((const, overloadable)) |
| 1319 | degrees(half2 v); |
| 1320 | #endif |
| 1321 | |
| 1322 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1323 | extern half3 __attribute__((const, overloadable)) |
| 1324 | degrees(half3 v); |
| 1325 | #endif |
| 1326 | |
| 1327 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1328 | extern half4 __attribute__((const, overloadable)) |
| 1329 | degrees(half4 v); |
| 1330 | #endif |
| 1331 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1332 | /* |
| 1333 | * erf: Mathematical error function |
| 1334 | * |
| 1335 | * Returns the error function. |
| 1336 | */ |
| 1337 | extern float __attribute__((const, overloadable)) |
| 1338 | erf(float v); |
| 1339 | |
| 1340 | extern float2 __attribute__((const, overloadable)) |
| 1341 | erf(float2 v); |
| 1342 | |
| 1343 | extern float3 __attribute__((const, overloadable)) |
| 1344 | erf(float3 v); |
| 1345 | |
| 1346 | extern float4 __attribute__((const, overloadable)) |
| 1347 | erf(float4 v); |
| 1348 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1349 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1350 | extern half __attribute__((const, overloadable)) |
| 1351 | erf(half v); |
| 1352 | #endif |
| 1353 | |
| 1354 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1355 | extern half2 __attribute__((const, overloadable)) |
| 1356 | erf(half2 v); |
| 1357 | #endif |
| 1358 | |
| 1359 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1360 | extern half3 __attribute__((const, overloadable)) |
| 1361 | erf(half3 v); |
| 1362 | #endif |
| 1363 | |
| 1364 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1365 | extern half4 __attribute__((const, overloadable)) |
| 1366 | erf(half4 v); |
| 1367 | #endif |
| 1368 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1369 | /* |
| 1370 | * erfc: Mathematical complementary error function |
| 1371 | * |
| 1372 | * Returns the complementary error function. |
| 1373 | */ |
| 1374 | extern float __attribute__((const, overloadable)) |
| 1375 | erfc(float v); |
| 1376 | |
| 1377 | extern float2 __attribute__((const, overloadable)) |
| 1378 | erfc(float2 v); |
| 1379 | |
| 1380 | extern float3 __attribute__((const, overloadable)) |
| 1381 | erfc(float3 v); |
| 1382 | |
| 1383 | extern float4 __attribute__((const, overloadable)) |
| 1384 | erfc(float4 v); |
| 1385 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1386 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1387 | extern half __attribute__((const, overloadable)) |
| 1388 | erfc(half v); |
| 1389 | #endif |
| 1390 | |
| 1391 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1392 | extern half2 __attribute__((const, overloadable)) |
| 1393 | erfc(half2 v); |
| 1394 | #endif |
| 1395 | |
| 1396 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1397 | extern half3 __attribute__((const, overloadable)) |
| 1398 | erfc(half3 v); |
| 1399 | #endif |
| 1400 | |
| 1401 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1402 | extern half4 __attribute__((const, overloadable)) |
| 1403 | erfc(half4 v); |
| 1404 | #endif |
| 1405 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1406 | /* |
| 1407 | * exp: e raised to a number |
| 1408 | * |
| 1409 | * Returns e raised to v, i.e. e ^ v. |
| 1410 | * |
| 1411 | * See also native_exp(). |
| 1412 | */ |
| 1413 | extern float __attribute__((const, overloadable)) |
| 1414 | exp(float v); |
| 1415 | |
| 1416 | extern float2 __attribute__((const, overloadable)) |
| 1417 | exp(float2 v); |
| 1418 | |
| 1419 | extern float3 __attribute__((const, overloadable)) |
| 1420 | exp(float3 v); |
| 1421 | |
| 1422 | extern float4 __attribute__((const, overloadable)) |
| 1423 | exp(float4 v); |
| 1424 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1425 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1426 | extern half __attribute__((const, overloadable)) |
| 1427 | exp(half v); |
| 1428 | #endif |
| 1429 | |
| 1430 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1431 | extern half2 __attribute__((const, overloadable)) |
| 1432 | exp(half2 v); |
| 1433 | #endif |
| 1434 | |
| 1435 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1436 | extern half3 __attribute__((const, overloadable)) |
| 1437 | exp(half3 v); |
| 1438 | #endif |
| 1439 | |
| 1440 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1441 | extern half4 __attribute__((const, overloadable)) |
| 1442 | exp(half4 v); |
| 1443 | #endif |
| 1444 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1445 | /* |
| 1446 | * exp10: 10 raised to a number |
| 1447 | * |
| 1448 | * Returns 10 raised to v, i.e. 10.f ^ v. |
| 1449 | * |
| 1450 | * See also native_exp10(). |
| 1451 | */ |
| 1452 | extern float __attribute__((const, overloadable)) |
| 1453 | exp10(float v); |
| 1454 | |
| 1455 | extern float2 __attribute__((const, overloadable)) |
| 1456 | exp10(float2 v); |
| 1457 | |
| 1458 | extern float3 __attribute__((const, overloadable)) |
| 1459 | exp10(float3 v); |
| 1460 | |
| 1461 | extern float4 __attribute__((const, overloadable)) |
| 1462 | exp10(float4 v); |
| 1463 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1464 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1465 | extern half __attribute__((const, overloadable)) |
| 1466 | exp10(half v); |
| 1467 | #endif |
| 1468 | |
| 1469 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1470 | extern half2 __attribute__((const, overloadable)) |
| 1471 | exp10(half2 v); |
| 1472 | #endif |
| 1473 | |
| 1474 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1475 | extern half3 __attribute__((const, overloadable)) |
| 1476 | exp10(half3 v); |
| 1477 | #endif |
| 1478 | |
| 1479 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1480 | extern half4 __attribute__((const, overloadable)) |
| 1481 | exp10(half4 v); |
| 1482 | #endif |
| 1483 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1484 | /* |
| 1485 | * exp2: 2 raised to a number |
| 1486 | * |
| 1487 | * Returns 2 raised to v, i.e. 2.f ^ v. |
| 1488 | * |
| 1489 | * See also native_exp2(). |
| 1490 | */ |
| 1491 | extern float __attribute__((const, overloadable)) |
| 1492 | exp2(float v); |
| 1493 | |
| 1494 | extern float2 __attribute__((const, overloadable)) |
| 1495 | exp2(float2 v); |
| 1496 | |
| 1497 | extern float3 __attribute__((const, overloadable)) |
| 1498 | exp2(float3 v); |
| 1499 | |
| 1500 | extern float4 __attribute__((const, overloadable)) |
| 1501 | exp2(float4 v); |
| 1502 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1503 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1504 | extern half __attribute__((const, overloadable)) |
| 1505 | exp2(half v); |
| 1506 | #endif |
| 1507 | |
| 1508 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1509 | extern half2 __attribute__((const, overloadable)) |
| 1510 | exp2(half2 v); |
| 1511 | #endif |
| 1512 | |
| 1513 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1514 | extern half3 __attribute__((const, overloadable)) |
| 1515 | exp2(half3 v); |
| 1516 | #endif |
| 1517 | |
| 1518 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1519 | extern half4 __attribute__((const, overloadable)) |
| 1520 | exp2(half4 v); |
| 1521 | #endif |
| 1522 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1523 | /* |
| 1524 | * expm1: e raised to a number minus one |
| 1525 | * |
| 1526 | * Returns e raised to v minus 1, i.e. (e ^ v) - 1. |
| 1527 | * |
| 1528 | * See also native_expm1(). |
| 1529 | */ |
| 1530 | extern float __attribute__((const, overloadable)) |
| 1531 | expm1(float v); |
| 1532 | |
| 1533 | extern float2 __attribute__((const, overloadable)) |
| 1534 | expm1(float2 v); |
| 1535 | |
| 1536 | extern float3 __attribute__((const, overloadable)) |
| 1537 | expm1(float3 v); |
| 1538 | |
| 1539 | extern float4 __attribute__((const, overloadable)) |
| 1540 | expm1(float4 v); |
| 1541 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1542 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1543 | extern half __attribute__((const, overloadable)) |
| 1544 | expm1(half v); |
| 1545 | #endif |
| 1546 | |
| 1547 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1548 | extern half2 __attribute__((const, overloadable)) |
| 1549 | expm1(half2 v); |
| 1550 | #endif |
| 1551 | |
| 1552 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1553 | extern half3 __attribute__((const, overloadable)) |
| 1554 | expm1(half3 v); |
| 1555 | #endif |
| 1556 | |
| 1557 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1558 | extern half4 __attribute__((const, overloadable)) |
| 1559 | expm1(half4 v); |
| 1560 | #endif |
| 1561 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1562 | /* |
| 1563 | * fabs: Absolute value of a float |
| 1564 | * |
| 1565 | * Returns the absolute value of the float v. |
| 1566 | * |
| 1567 | * For integers, use abs(). |
| 1568 | */ |
| 1569 | extern float __attribute__((const, overloadable)) |
| 1570 | fabs(float v); |
| 1571 | |
| 1572 | extern float2 __attribute__((const, overloadable)) |
| 1573 | fabs(float2 v); |
| 1574 | |
| 1575 | extern float3 __attribute__((const, overloadable)) |
| 1576 | fabs(float3 v); |
| 1577 | |
| 1578 | extern float4 __attribute__((const, overloadable)) |
| 1579 | fabs(float4 v); |
| 1580 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1581 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1582 | extern half __attribute__((const, overloadable)) |
| 1583 | fabs(half v); |
| 1584 | #endif |
| 1585 | |
| 1586 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1587 | extern half2 __attribute__((const, overloadable)) |
| 1588 | fabs(half2 v); |
| 1589 | #endif |
| 1590 | |
| 1591 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1592 | extern half3 __attribute__((const, overloadable)) |
| 1593 | fabs(half3 v); |
| 1594 | #endif |
| 1595 | |
| 1596 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1597 | extern half4 __attribute__((const, overloadable)) |
| 1598 | fabs(half4 v); |
| 1599 | #endif |
| 1600 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1601 | /* |
| 1602 | * fdim: Positive difference between two values |
| 1603 | * |
| 1604 | * Returns the positive difference between two values. |
| 1605 | * |
| 1606 | * If a > b, returns (a - b) otherwise returns 0f. |
| 1607 | */ |
| 1608 | extern float __attribute__((const, overloadable)) |
| 1609 | fdim(float a, float b); |
| 1610 | |
| 1611 | extern float2 __attribute__((const, overloadable)) |
| 1612 | fdim(float2 a, float2 b); |
| 1613 | |
| 1614 | extern float3 __attribute__((const, overloadable)) |
| 1615 | fdim(float3 a, float3 b); |
| 1616 | |
| 1617 | extern float4 __attribute__((const, overloadable)) |
| 1618 | fdim(float4 a, float4 b); |
| 1619 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1620 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1621 | extern half __attribute__((const, overloadable)) |
| 1622 | fdim(half a, half b); |
| 1623 | #endif |
| 1624 | |
| 1625 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1626 | extern half2 __attribute__((const, overloadable)) |
| 1627 | fdim(half2 a, half2 b); |
| 1628 | #endif |
| 1629 | |
| 1630 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1631 | extern half3 __attribute__((const, overloadable)) |
| 1632 | fdim(half3 a, half3 b); |
| 1633 | #endif |
| 1634 | |
| 1635 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1636 | extern half4 __attribute__((const, overloadable)) |
| 1637 | fdim(half4 a, half4 b); |
| 1638 | #endif |
| 1639 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1640 | /* |
| 1641 | * floor: Smallest integer not greater than a value |
| 1642 | * |
| 1643 | * Returns the smallest integer not greater than a value. |
| 1644 | * |
| 1645 | * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f. |
| 1646 | * |
| 1647 | * See also ceil(). |
| 1648 | */ |
| 1649 | extern float __attribute__((const, overloadable)) |
| 1650 | floor(float v); |
| 1651 | |
| 1652 | extern float2 __attribute__((const, overloadable)) |
| 1653 | floor(float2 v); |
| 1654 | |
| 1655 | extern float3 __attribute__((const, overloadable)) |
| 1656 | floor(float3 v); |
| 1657 | |
| 1658 | extern float4 __attribute__((const, overloadable)) |
| 1659 | floor(float4 v); |
| 1660 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1661 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1662 | extern half __attribute__((const, overloadable)) |
| 1663 | floor(half v); |
| 1664 | #endif |
| 1665 | |
| 1666 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1667 | extern half2 __attribute__((const, overloadable)) |
| 1668 | floor(half2 v); |
| 1669 | #endif |
| 1670 | |
| 1671 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1672 | extern half3 __attribute__((const, overloadable)) |
| 1673 | floor(half3 v); |
| 1674 | #endif |
| 1675 | |
| 1676 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1677 | extern half4 __attribute__((const, overloadable)) |
| 1678 | floor(half4 v); |
| 1679 | #endif |
| 1680 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1681 | /* |
| 1682 | * fma: Multiply and add |
| 1683 | * |
| 1684 | * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset. |
| 1685 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 1686 | * This function is similar to mad(). fma() retains full precision of the multiplied result |
| 1687 | * and rounds only after the addition. mad() rounds after the multiplication and the addition. |
| 1688 | * This extra precision is not guaranteed in rs_fp_relaxed mode. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1689 | */ |
| 1690 | extern float __attribute__((const, overloadable)) |
| 1691 | fma(float multiplicand1, float multiplicand2, float offset); |
| 1692 | |
| 1693 | extern float2 __attribute__((const, overloadable)) |
| 1694 | fma(float2 multiplicand1, float2 multiplicand2, float2 offset); |
| 1695 | |
| 1696 | extern float3 __attribute__((const, overloadable)) |
| 1697 | fma(float3 multiplicand1, float3 multiplicand2, float3 offset); |
| 1698 | |
| 1699 | extern float4 __attribute__((const, overloadable)) |
| 1700 | fma(float4 multiplicand1, float4 multiplicand2, float4 offset); |
| 1701 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1702 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1703 | extern half __attribute__((const, overloadable)) |
| 1704 | fma(half multiplicand1, half multiplicand2, half offset); |
| 1705 | #endif |
| 1706 | |
| 1707 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1708 | extern half2 __attribute__((const, overloadable)) |
| 1709 | fma(half2 multiplicand1, half2 multiplicand2, half2 offset); |
| 1710 | #endif |
| 1711 | |
| 1712 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1713 | extern half3 __attribute__((const, overloadable)) |
| 1714 | fma(half3 multiplicand1, half3 multiplicand2, half3 offset); |
| 1715 | #endif |
| 1716 | |
| 1717 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1718 | extern half4 __attribute__((const, overloadable)) |
| 1719 | fma(half4 multiplicand1, half4 multiplicand2, half4 offset); |
| 1720 | #endif |
| 1721 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1722 | /* |
| 1723 | * fmax: Maximum of two floats |
| 1724 | * |
| 1725 | * Returns the maximum of a and b, i.e. (a < b ? b : a). |
| 1726 | * |
| 1727 | * The max() function returns identical results but can be applied to more data types. |
| 1728 | */ |
| 1729 | extern float __attribute__((const, overloadable)) |
| 1730 | fmax(float a, float b); |
| 1731 | |
| 1732 | extern float2 __attribute__((const, overloadable)) |
| 1733 | fmax(float2 a, float2 b); |
| 1734 | |
| 1735 | extern float3 __attribute__((const, overloadable)) |
| 1736 | fmax(float3 a, float3 b); |
| 1737 | |
| 1738 | extern float4 __attribute__((const, overloadable)) |
| 1739 | fmax(float4 a, float4 b); |
| 1740 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1741 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1742 | extern half __attribute__((const, overloadable)) |
| 1743 | fmax(half a, half b); |
| 1744 | #endif |
| 1745 | |
| 1746 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1747 | extern half2 __attribute__((const, overloadable)) |
| 1748 | fmax(half2 a, half2 b); |
| 1749 | #endif |
| 1750 | |
| 1751 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1752 | extern half3 __attribute__((const, overloadable)) |
| 1753 | fmax(half3 a, half3 b); |
| 1754 | #endif |
| 1755 | |
| 1756 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1757 | extern half4 __attribute__((const, overloadable)) |
| 1758 | fmax(half4 a, half4 b); |
| 1759 | #endif |
| 1760 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1761 | extern float2 __attribute__((const, overloadable)) |
| 1762 | fmax(float2 a, float b); |
| 1763 | |
| 1764 | extern float3 __attribute__((const, overloadable)) |
| 1765 | fmax(float3 a, float b); |
| 1766 | |
| 1767 | extern float4 __attribute__((const, overloadable)) |
| 1768 | fmax(float4 a, float b); |
| 1769 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1770 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1771 | extern half2 __attribute__((const, overloadable)) |
| 1772 | fmax(half2 a, half b); |
| 1773 | #endif |
| 1774 | |
| 1775 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1776 | extern half3 __attribute__((const, overloadable)) |
| 1777 | fmax(half3 a, half b); |
| 1778 | #endif |
| 1779 | |
| 1780 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1781 | extern half4 __attribute__((const, overloadable)) |
| 1782 | fmax(half4 a, half b); |
| 1783 | #endif |
| 1784 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1785 | /* |
| 1786 | * fmin: Minimum of two floats |
| 1787 | * |
| 1788 | * Returns the minimum of a and b, i.e. (a > b ? b : a). |
| 1789 | * |
| 1790 | * The min() function returns identical results but can be applied to more data types. |
| 1791 | */ |
| 1792 | extern float __attribute__((const, overloadable)) |
| 1793 | fmin(float a, float b); |
| 1794 | |
| 1795 | extern float2 __attribute__((const, overloadable)) |
| 1796 | fmin(float2 a, float2 b); |
| 1797 | |
| 1798 | extern float3 __attribute__((const, overloadable)) |
| 1799 | fmin(float3 a, float3 b); |
| 1800 | |
| 1801 | extern float4 __attribute__((const, overloadable)) |
| 1802 | fmin(float4 a, float4 b); |
| 1803 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1804 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1805 | extern half __attribute__((const, overloadable)) |
| 1806 | fmin(half a, half b); |
| 1807 | #endif |
| 1808 | |
| 1809 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1810 | extern half2 __attribute__((const, overloadable)) |
| 1811 | fmin(half2 a, half2 b); |
| 1812 | #endif |
| 1813 | |
| 1814 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1815 | extern half3 __attribute__((const, overloadable)) |
| 1816 | fmin(half3 a, half3 b); |
| 1817 | #endif |
| 1818 | |
| 1819 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1820 | extern half4 __attribute__((const, overloadable)) |
| 1821 | fmin(half4 a, half4 b); |
| 1822 | #endif |
| 1823 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1824 | extern float2 __attribute__((const, overloadable)) |
| 1825 | fmin(float2 a, float b); |
| 1826 | |
| 1827 | extern float3 __attribute__((const, overloadable)) |
| 1828 | fmin(float3 a, float b); |
| 1829 | |
| 1830 | extern float4 __attribute__((const, overloadable)) |
| 1831 | fmin(float4 a, float b); |
| 1832 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1833 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1834 | extern half2 __attribute__((const, overloadable)) |
| 1835 | fmin(half2 a, half b); |
| 1836 | #endif |
| 1837 | |
| 1838 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1839 | extern half3 __attribute__((const, overloadable)) |
| 1840 | fmin(half3 a, half b); |
| 1841 | #endif |
| 1842 | |
| 1843 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1844 | extern half4 __attribute__((const, overloadable)) |
| 1845 | fmin(half4 a, half b); |
| 1846 | #endif |
| 1847 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1848 | /* |
| 1849 | * fmod: Modulo |
| 1850 | * |
| 1851 | * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero. |
| 1852 | * |
| 1853 | * The function remainder() is similar but rounds toward the closest interger. |
| 1854 | * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f) |
| 1855 | * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f). |
| 1856 | */ |
| 1857 | extern float __attribute__((const, overloadable)) |
| 1858 | fmod(float numerator, float denominator); |
| 1859 | |
| 1860 | extern float2 __attribute__((const, overloadable)) |
| 1861 | fmod(float2 numerator, float2 denominator); |
| 1862 | |
| 1863 | extern float3 __attribute__((const, overloadable)) |
| 1864 | fmod(float3 numerator, float3 denominator); |
| 1865 | |
| 1866 | extern float4 __attribute__((const, overloadable)) |
| 1867 | fmod(float4 numerator, float4 denominator); |
| 1868 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 1869 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1870 | extern half __attribute__((const, overloadable)) |
| 1871 | fmod(half numerator, half denominator); |
| 1872 | #endif |
| 1873 | |
| 1874 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1875 | extern half2 __attribute__((const, overloadable)) |
| 1876 | fmod(half2 numerator, half2 denominator); |
| 1877 | #endif |
| 1878 | |
| 1879 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1880 | extern half3 __attribute__((const, overloadable)) |
| 1881 | fmod(half3 numerator, half3 denominator); |
| 1882 | #endif |
| 1883 | |
| 1884 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 1885 | extern half4 __attribute__((const, overloadable)) |
| 1886 | fmod(half4 numerator, half4 denominator); |
| 1887 | #endif |
| 1888 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1889 | /* |
| 1890 | * fract: Positive fractional part |
| 1891 | * |
| 1892 | * Returns the positive fractional part of v, i.e. v - floor(v). |
| 1893 | * |
| 1894 | * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f. |
| 1895 | * fract(-1.3f, &val) returns 0.7f and sets val to -2.f. |
| 1896 | * |
| 1897 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 1898 | * v: Input value. |
| 1899 | * 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] | 1900 | */ |
| 1901 | extern float __attribute__((overloadable)) |
| 1902 | fract(float v, float* floor); |
| 1903 | |
| 1904 | extern float2 __attribute__((overloadable)) |
| 1905 | fract(float2 v, float2* floor); |
| 1906 | |
| 1907 | extern float3 __attribute__((overloadable)) |
| 1908 | fract(float3 v, float3* floor); |
| 1909 | |
| 1910 | extern float4 __attribute__((overloadable)) |
| 1911 | fract(float4 v, float4* floor); |
| 1912 | |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1913 | #if !defined(RS_VERSION) || (RS_VERSION <= 23) |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1914 | static inline float __attribute__((const, overloadable)) |
| 1915 | fract(float v) { |
| 1916 | float unused; |
| 1917 | return fract(v, &unused); |
| 1918 | } |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1919 | #endif |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1920 | |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1921 | #if !defined(RS_VERSION) || (RS_VERSION <= 23) |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1922 | static inline float2 __attribute__((const, overloadable)) |
| 1923 | fract(float2 v) { |
| 1924 | float2 unused; |
| 1925 | return fract(v, &unused); |
| 1926 | } |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1927 | #endif |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1928 | |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1929 | #if !defined(RS_VERSION) || (RS_VERSION <= 23) |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1930 | static inline float3 __attribute__((const, overloadable)) |
| 1931 | fract(float3 v) { |
| 1932 | float3 unused; |
| 1933 | return fract(v, &unused); |
| 1934 | } |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1935 | #endif |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1936 | |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1937 | #if !defined(RS_VERSION) || (RS_VERSION <= 23) |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1938 | static inline float4 __attribute__((const, overloadable)) |
| 1939 | fract(float4 v) { |
| 1940 | float4 unused; |
| 1941 | return fract(v, &unused); |
| 1942 | } |
Verena Beckham | 9cbc99b | 2015-11-16 12:25:54 +0000 | [diff] [blame^] | 1943 | #endif |
| 1944 | |
| 1945 | #if (defined(RS_VERSION) && (RS_VERSION >= 24)) |
| 1946 | extern float __attribute__((overloadable)) |
| 1947 | fract(float v); |
| 1948 | #endif |
| 1949 | |
| 1950 | #if (defined(RS_VERSION) && (RS_VERSION >= 24)) |
| 1951 | extern float2 __attribute__((overloadable)) |
| 1952 | fract(float2 v); |
| 1953 | #endif |
| 1954 | |
| 1955 | #if (defined(RS_VERSION) && (RS_VERSION >= 24)) |
| 1956 | extern float3 __attribute__((overloadable)) |
| 1957 | fract(float3 v); |
| 1958 | #endif |
| 1959 | |
| 1960 | #if (defined(RS_VERSION) && (RS_VERSION >= 24)) |
| 1961 | extern float4 __attribute__((overloadable)) |
| 1962 | fract(float4 v); |
| 1963 | #endif |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 1964 | |
| 1965 | /* |
| 1966 | * frexp: Binary mantissa and exponent |
| 1967 | * |
| 1968 | * Returns the binary mantissa and exponent of v, i.e. v == mantissa * 2 ^ exponent. |
| 1969 | * |
| 1970 | * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive). |
| 1971 | * |
| 1972 | * See ldexp() for the reverse operation. See also logb() and ilogb(). |
| 1973 | * |
| 1974 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 1975 | * v: Input value. |
| 1976 | * 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] | 1977 | */ |
| 1978 | extern float __attribute__((overloadable)) |
| 1979 | frexp(float v, int* exponent); |
| 1980 | |
| 1981 | extern float2 __attribute__((overloadable)) |
| 1982 | frexp(float2 v, int2* exponent); |
| 1983 | |
| 1984 | extern float3 __attribute__((overloadable)) |
| 1985 | frexp(float3 v, int3* exponent); |
| 1986 | |
| 1987 | extern float4 __attribute__((overloadable)) |
| 1988 | frexp(float4 v, int4* exponent); |
| 1989 | |
| 1990 | /* |
| 1991 | * half_recip: Reciprocal computed to 16 bit precision |
| 1992 | * |
| 1993 | * Returns the approximate reciprocal of a value. |
| 1994 | * |
| 1995 | * The precision is that of a 16 bit floating point value. |
| 1996 | * |
| 1997 | * See also native_recip(). |
| 1998 | */ |
| 1999 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2000 | extern float __attribute__((const, overloadable)) |
| 2001 | half_recip(float v); |
| 2002 | #endif |
| 2003 | |
| 2004 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2005 | extern float2 __attribute__((const, overloadable)) |
| 2006 | half_recip(float2 v); |
| 2007 | #endif |
| 2008 | |
| 2009 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2010 | extern float3 __attribute__((const, overloadable)) |
| 2011 | half_recip(float3 v); |
| 2012 | #endif |
| 2013 | |
| 2014 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2015 | extern float4 __attribute__((const, overloadable)) |
| 2016 | half_recip(float4 v); |
| 2017 | #endif |
| 2018 | |
| 2019 | /* |
| 2020 | * half_rsqrt: Reciprocal of a square root computed to 16 bit precision |
| 2021 | * |
| 2022 | * Returns the approximate value of (1.f / sqrt(value)). |
| 2023 | * |
| 2024 | * The precision is that of a 16 bit floating point value. |
| 2025 | * |
| 2026 | * See also rsqrt(), native_rsqrt(). |
| 2027 | */ |
| 2028 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2029 | extern float __attribute__((const, overloadable)) |
| 2030 | half_rsqrt(float v); |
| 2031 | #endif |
| 2032 | |
| 2033 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2034 | extern float2 __attribute__((const, overloadable)) |
| 2035 | half_rsqrt(float2 v); |
| 2036 | #endif |
| 2037 | |
| 2038 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2039 | extern float3 __attribute__((const, overloadable)) |
| 2040 | half_rsqrt(float3 v); |
| 2041 | #endif |
| 2042 | |
| 2043 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2044 | extern float4 __attribute__((const, overloadable)) |
| 2045 | half_rsqrt(float4 v); |
| 2046 | #endif |
| 2047 | |
| 2048 | /* |
| 2049 | * half_sqrt: Square root computed to 16 bit precision |
| 2050 | * |
| 2051 | * Returns the approximate square root of a value. |
| 2052 | * |
| 2053 | * The precision is that of a 16 bit floating point value. |
| 2054 | * |
| 2055 | * See also sqrt(), native_sqrt(). |
| 2056 | */ |
| 2057 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2058 | extern float __attribute__((const, overloadable)) |
| 2059 | half_sqrt(float v); |
| 2060 | #endif |
| 2061 | |
| 2062 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2063 | extern float2 __attribute__((const, overloadable)) |
| 2064 | half_sqrt(float2 v); |
| 2065 | #endif |
| 2066 | |
| 2067 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2068 | extern float3 __attribute__((const, overloadable)) |
| 2069 | half_sqrt(float3 v); |
| 2070 | #endif |
| 2071 | |
| 2072 | #if (defined(RS_VERSION) && (RS_VERSION >= 17)) |
| 2073 | extern float4 __attribute__((const, overloadable)) |
| 2074 | half_sqrt(float4 v); |
| 2075 | #endif |
| 2076 | |
| 2077 | /* |
| 2078 | * hypot: Hypotenuse |
| 2079 | * |
| 2080 | * Returns the hypotenuse, i.e. sqrt(a * a + b * b). |
| 2081 | * |
| 2082 | * See also native_hypot(). |
| 2083 | */ |
| 2084 | extern float __attribute__((const, overloadable)) |
| 2085 | hypot(float a, float b); |
| 2086 | |
| 2087 | extern float2 __attribute__((const, overloadable)) |
| 2088 | hypot(float2 a, float2 b); |
| 2089 | |
| 2090 | extern float3 __attribute__((const, overloadable)) |
| 2091 | hypot(float3 a, float3 b); |
| 2092 | |
| 2093 | extern float4 __attribute__((const, overloadable)) |
| 2094 | hypot(float4 a, float4 b); |
| 2095 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2096 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2097 | extern half __attribute__((const, overloadable)) |
| 2098 | hypot(half a, half b); |
| 2099 | #endif |
| 2100 | |
| 2101 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2102 | extern half2 __attribute__((const, overloadable)) |
| 2103 | hypot(half2 a, half2 b); |
| 2104 | #endif |
| 2105 | |
| 2106 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2107 | extern half3 __attribute__((const, overloadable)) |
| 2108 | hypot(half3 a, half3 b); |
| 2109 | #endif |
| 2110 | |
| 2111 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2112 | extern half4 __attribute__((const, overloadable)) |
| 2113 | hypot(half4 a, half4 b); |
| 2114 | #endif |
| 2115 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2116 | /* |
| 2117 | * ilogb: Base two exponent |
| 2118 | * |
| 2119 | * Returns the base two exponent of a value, where the mantissa is between |
| 2120 | * 1.f (inclusive) and 2.f (exclusive). |
| 2121 | * |
| 2122 | * For example, ilogb(8.5f) returns 3. |
| 2123 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2124 | * 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] | 2125 | * |
| 2126 | * logb() is similar but returns a float. |
| 2127 | */ |
| 2128 | extern int __attribute__((const, overloadable)) |
| 2129 | ilogb(float v); |
| 2130 | |
| 2131 | extern int2 __attribute__((const, overloadable)) |
| 2132 | ilogb(float2 v); |
| 2133 | |
| 2134 | extern int3 __attribute__((const, overloadable)) |
| 2135 | ilogb(float3 v); |
| 2136 | |
| 2137 | extern int4 __attribute__((const, overloadable)) |
| 2138 | ilogb(float4 v); |
| 2139 | |
| 2140 | /* |
| 2141 | * ldexp: Creates a floating point from mantissa and exponent |
| 2142 | * |
| 2143 | * Returns the floating point created from the mantissa and exponent, |
| 2144 | * i.e. (mantissa * 2 ^ exponent). |
| 2145 | * |
| 2146 | * See frexp() for the reverse operation. |
| 2147 | * |
| 2148 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2149 | * mantissa: Mantissa. |
| 2150 | * exponent: Exponent, a single component or matching vector. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2151 | */ |
| 2152 | extern float __attribute__((const, overloadable)) |
| 2153 | ldexp(float mantissa, int exponent); |
| 2154 | |
| 2155 | extern float2 __attribute__((const, overloadable)) |
| 2156 | ldexp(float2 mantissa, int2 exponent); |
| 2157 | |
| 2158 | extern float3 __attribute__((const, overloadable)) |
| 2159 | ldexp(float3 mantissa, int3 exponent); |
| 2160 | |
| 2161 | extern float4 __attribute__((const, overloadable)) |
| 2162 | ldexp(float4 mantissa, int4 exponent); |
| 2163 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2164 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2165 | extern half __attribute__((const, overloadable)) |
| 2166 | ldexp(half mantissa, int exponent); |
| 2167 | #endif |
| 2168 | |
| 2169 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2170 | extern half2 __attribute__((const, overloadable)) |
| 2171 | ldexp(half2 mantissa, int2 exponent); |
| 2172 | #endif |
| 2173 | |
| 2174 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2175 | extern half3 __attribute__((const, overloadable)) |
| 2176 | ldexp(half3 mantissa, int3 exponent); |
| 2177 | #endif |
| 2178 | |
| 2179 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2180 | extern half4 __attribute__((const, overloadable)) |
| 2181 | ldexp(half4 mantissa, int4 exponent); |
| 2182 | #endif |
| 2183 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2184 | extern float2 __attribute__((const, overloadable)) |
| 2185 | ldexp(float2 mantissa, int exponent); |
| 2186 | |
| 2187 | extern float3 __attribute__((const, overloadable)) |
| 2188 | ldexp(float3 mantissa, int exponent); |
| 2189 | |
| 2190 | extern float4 __attribute__((const, overloadable)) |
| 2191 | ldexp(float4 mantissa, int exponent); |
| 2192 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2193 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2194 | extern half2 __attribute__((const, overloadable)) |
| 2195 | ldexp(half2 mantissa, int exponent); |
| 2196 | #endif |
| 2197 | |
| 2198 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2199 | extern half3 __attribute__((const, overloadable)) |
| 2200 | ldexp(half3 mantissa, int exponent); |
| 2201 | #endif |
| 2202 | |
| 2203 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2204 | extern half4 __attribute__((const, overloadable)) |
| 2205 | ldexp(half4 mantissa, int exponent); |
| 2206 | #endif |
| 2207 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2208 | /* |
| 2209 | * lgamma: Natural logarithm of the gamma function |
| 2210 | * |
| 2211 | * Returns the natural logarithm of the absolute value of the gamma function, |
| 2212 | * i.e. log(fabs(tgamma(v))). |
| 2213 | * |
| 2214 | * See also tgamma(). |
| 2215 | * |
| 2216 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 2217 | * 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] | 2218 | */ |
| 2219 | extern float __attribute__((const, overloadable)) |
| 2220 | lgamma(float v); |
| 2221 | |
| 2222 | extern float2 __attribute__((const, overloadable)) |
| 2223 | lgamma(float2 v); |
| 2224 | |
| 2225 | extern float3 __attribute__((const, overloadable)) |
| 2226 | lgamma(float3 v); |
| 2227 | |
| 2228 | extern float4 __attribute__((const, overloadable)) |
| 2229 | lgamma(float4 v); |
| 2230 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2231 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2232 | extern half __attribute__((const, overloadable)) |
| 2233 | lgamma(half v); |
| 2234 | #endif |
| 2235 | |
| 2236 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2237 | extern half2 __attribute__((const, overloadable)) |
| 2238 | lgamma(half2 v); |
| 2239 | #endif |
| 2240 | |
| 2241 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2242 | extern half3 __attribute__((const, overloadable)) |
| 2243 | lgamma(half3 v); |
| 2244 | #endif |
| 2245 | |
| 2246 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2247 | extern half4 __attribute__((const, overloadable)) |
| 2248 | lgamma(half4 v); |
| 2249 | #endif |
| 2250 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2251 | extern float __attribute__((overloadable)) |
| 2252 | lgamma(float v, int* sign_of_gamma); |
| 2253 | |
| 2254 | extern float2 __attribute__((overloadable)) |
| 2255 | lgamma(float2 v, int2* sign_of_gamma); |
| 2256 | |
| 2257 | extern float3 __attribute__((overloadable)) |
| 2258 | lgamma(float3 v, int3* sign_of_gamma); |
| 2259 | |
| 2260 | extern float4 __attribute__((overloadable)) |
| 2261 | lgamma(float4 v, int4* sign_of_gamma); |
| 2262 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2263 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2264 | extern half __attribute__((overloadable)) |
| 2265 | lgamma(half v, int* sign_of_gamma); |
| 2266 | #endif |
| 2267 | |
| 2268 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2269 | extern half2 __attribute__((overloadable)) |
| 2270 | lgamma(half2 v, int2* sign_of_gamma); |
| 2271 | #endif |
| 2272 | |
| 2273 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2274 | extern half3 __attribute__((overloadable)) |
| 2275 | lgamma(half3 v, int3* sign_of_gamma); |
| 2276 | #endif |
| 2277 | |
| 2278 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2279 | extern half4 __attribute__((overloadable)) |
| 2280 | lgamma(half4 v, int4* sign_of_gamma); |
| 2281 | #endif |
| 2282 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2283 | /* |
| 2284 | * log: Natural logarithm |
| 2285 | * |
| 2286 | * Returns the natural logarithm. |
| 2287 | * |
| 2288 | * See also native_log(). |
| 2289 | */ |
| 2290 | extern float __attribute__((const, overloadable)) |
| 2291 | log(float v); |
| 2292 | |
| 2293 | extern float2 __attribute__((const, overloadable)) |
| 2294 | log(float2 v); |
| 2295 | |
| 2296 | extern float3 __attribute__((const, overloadable)) |
| 2297 | log(float3 v); |
| 2298 | |
| 2299 | extern float4 __attribute__((const, overloadable)) |
| 2300 | log(float4 v); |
| 2301 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2302 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2303 | extern half __attribute__((const, overloadable)) |
| 2304 | log(half v); |
| 2305 | #endif |
| 2306 | |
| 2307 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2308 | extern half2 __attribute__((const, overloadable)) |
| 2309 | log(half2 v); |
| 2310 | #endif |
| 2311 | |
| 2312 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2313 | extern half3 __attribute__((const, overloadable)) |
| 2314 | log(half3 v); |
| 2315 | #endif |
| 2316 | |
| 2317 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2318 | extern half4 __attribute__((const, overloadable)) |
| 2319 | log(half4 v); |
| 2320 | #endif |
| 2321 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2322 | /* |
| 2323 | * log10: Base 10 logarithm |
| 2324 | * |
| 2325 | * Returns the base 10 logarithm. |
| 2326 | * |
| 2327 | * See also native_log10(). |
| 2328 | */ |
| 2329 | extern float __attribute__((const, overloadable)) |
| 2330 | log10(float v); |
| 2331 | |
| 2332 | extern float2 __attribute__((const, overloadable)) |
| 2333 | log10(float2 v); |
| 2334 | |
| 2335 | extern float3 __attribute__((const, overloadable)) |
| 2336 | log10(float3 v); |
| 2337 | |
| 2338 | extern float4 __attribute__((const, overloadable)) |
| 2339 | log10(float4 v); |
| 2340 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2341 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2342 | extern half __attribute__((const, overloadable)) |
| 2343 | log10(half v); |
| 2344 | #endif |
| 2345 | |
| 2346 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2347 | extern half2 __attribute__((const, overloadable)) |
| 2348 | log10(half2 v); |
| 2349 | #endif |
| 2350 | |
| 2351 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2352 | extern half3 __attribute__((const, overloadable)) |
| 2353 | log10(half3 v); |
| 2354 | #endif |
| 2355 | |
| 2356 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2357 | extern half4 __attribute__((const, overloadable)) |
| 2358 | log10(half4 v); |
| 2359 | #endif |
| 2360 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2361 | /* |
| 2362 | * log1p: Natural logarithm of a value plus 1 |
| 2363 | * |
| 2364 | * Returns the natural logarithm of (v + 1.f). |
| 2365 | * |
| 2366 | * See also native_log1p(). |
| 2367 | */ |
| 2368 | extern float __attribute__((const, overloadable)) |
| 2369 | log1p(float v); |
| 2370 | |
| 2371 | extern float2 __attribute__((const, overloadable)) |
| 2372 | log1p(float2 v); |
| 2373 | |
| 2374 | extern float3 __attribute__((const, overloadable)) |
| 2375 | log1p(float3 v); |
| 2376 | |
| 2377 | extern float4 __attribute__((const, overloadable)) |
| 2378 | log1p(float4 v); |
| 2379 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2380 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2381 | extern half __attribute__((const, overloadable)) |
| 2382 | log1p(half v); |
| 2383 | #endif |
| 2384 | |
| 2385 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2386 | extern half2 __attribute__((const, overloadable)) |
| 2387 | log1p(half2 v); |
| 2388 | #endif |
| 2389 | |
| 2390 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2391 | extern half3 __attribute__((const, overloadable)) |
| 2392 | log1p(half3 v); |
| 2393 | #endif |
| 2394 | |
| 2395 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2396 | extern half4 __attribute__((const, overloadable)) |
| 2397 | log1p(half4 v); |
| 2398 | #endif |
| 2399 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2400 | /* |
| 2401 | * log2: Base 2 logarithm |
| 2402 | * |
| 2403 | * Returns the base 2 logarithm. |
| 2404 | * |
| 2405 | * See also native_log2(). |
| 2406 | */ |
| 2407 | extern float __attribute__((const, overloadable)) |
| 2408 | log2(float v); |
| 2409 | |
| 2410 | extern float2 __attribute__((const, overloadable)) |
| 2411 | log2(float2 v); |
| 2412 | |
| 2413 | extern float3 __attribute__((const, overloadable)) |
| 2414 | log2(float3 v); |
| 2415 | |
| 2416 | extern float4 __attribute__((const, overloadable)) |
| 2417 | log2(float4 v); |
| 2418 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2419 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2420 | extern half __attribute__((const, overloadable)) |
| 2421 | log2(half v); |
| 2422 | #endif |
| 2423 | |
| 2424 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2425 | extern half2 __attribute__((const, overloadable)) |
| 2426 | log2(half2 v); |
| 2427 | #endif |
| 2428 | |
| 2429 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2430 | extern half3 __attribute__((const, overloadable)) |
| 2431 | log2(half3 v); |
| 2432 | #endif |
| 2433 | |
| 2434 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2435 | extern half4 __attribute__((const, overloadable)) |
| 2436 | log2(half4 v); |
| 2437 | #endif |
| 2438 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2439 | /* |
| 2440 | * logb: Base two exponent |
| 2441 | * |
| 2442 | * Returns the base two exponent of a value, where the mantissa is between |
| 2443 | * 1.f (inclusive) and 2.f (exclusive). |
| 2444 | * |
| 2445 | * For example, logb(8.5f) returns 3.f. |
| 2446 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2447 | * 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] | 2448 | * |
| 2449 | * ilogb() is similar but returns an integer. |
| 2450 | */ |
| 2451 | extern float __attribute__((const, overloadable)) |
| 2452 | logb(float v); |
| 2453 | |
| 2454 | extern float2 __attribute__((const, overloadable)) |
| 2455 | logb(float2 v); |
| 2456 | |
| 2457 | extern float3 __attribute__((const, overloadable)) |
| 2458 | logb(float3 v); |
| 2459 | |
| 2460 | extern float4 __attribute__((const, overloadable)) |
| 2461 | logb(float4 v); |
| 2462 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2463 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2464 | extern half __attribute__((const, overloadable)) |
| 2465 | logb(half v); |
| 2466 | #endif |
| 2467 | |
| 2468 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2469 | extern half2 __attribute__((const, overloadable)) |
| 2470 | logb(half2 v); |
| 2471 | #endif |
| 2472 | |
| 2473 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2474 | extern half3 __attribute__((const, overloadable)) |
| 2475 | logb(half3 v); |
| 2476 | #endif |
| 2477 | |
| 2478 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2479 | extern half4 __attribute__((const, overloadable)) |
| 2480 | logb(half4 v); |
| 2481 | #endif |
| 2482 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2483 | /* |
| 2484 | * mad: Multiply and add |
| 2485 | * |
| 2486 | * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset. |
| 2487 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 2488 | * This function is similar to fma(). fma() retains full precision of the multiplied result |
| 2489 | * and rounds only after the addition. mad() rounds after the multiplication and the addition. |
| 2490 | * 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] | 2491 | */ |
| 2492 | extern float __attribute__((const, overloadable)) |
| 2493 | mad(float multiplicand1, float multiplicand2, float offset); |
| 2494 | |
| 2495 | extern float2 __attribute__((const, overloadable)) |
| 2496 | mad(float2 multiplicand1, float2 multiplicand2, float2 offset); |
| 2497 | |
| 2498 | extern float3 __attribute__((const, overloadable)) |
| 2499 | mad(float3 multiplicand1, float3 multiplicand2, float3 offset); |
| 2500 | |
| 2501 | extern float4 __attribute__((const, overloadable)) |
| 2502 | mad(float4 multiplicand1, float4 multiplicand2, float4 offset); |
| 2503 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2504 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2505 | extern half __attribute__((const, overloadable)) |
| 2506 | mad(half multiplicand1, half multiplicand2, half offset); |
| 2507 | #endif |
| 2508 | |
| 2509 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2510 | extern half2 __attribute__((const, overloadable)) |
| 2511 | mad(half2 multiplicand1, half2 multiplicand2, half2 offset); |
| 2512 | #endif |
| 2513 | |
| 2514 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2515 | extern half3 __attribute__((const, overloadable)) |
| 2516 | mad(half3 multiplicand1, half3 multiplicand2, half3 offset); |
| 2517 | #endif |
| 2518 | |
| 2519 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2520 | extern half4 __attribute__((const, overloadable)) |
| 2521 | mad(half4 multiplicand1, half4 multiplicand2, half4 offset); |
| 2522 | #endif |
| 2523 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2524 | /* |
| 2525 | * max: Maximum |
| 2526 | * |
| 2527 | * Returns the maximum value of two arguments. |
| 2528 | */ |
| 2529 | extern float __attribute__((const, overloadable)) |
| 2530 | max(float a, float b); |
| 2531 | |
| 2532 | extern float2 __attribute__((const, overloadable)) |
| 2533 | max(float2 a, float2 b); |
| 2534 | |
| 2535 | extern float3 __attribute__((const, overloadable)) |
| 2536 | max(float3 a, float3 b); |
| 2537 | |
| 2538 | extern float4 __attribute__((const, overloadable)) |
| 2539 | max(float4 a, float4 b); |
| 2540 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2541 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2542 | extern half __attribute__((const, overloadable)) |
| 2543 | max(half a, half b); |
| 2544 | #endif |
| 2545 | |
| 2546 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2547 | extern half2 __attribute__((const, overloadable)) |
| 2548 | max(half2 a, half2 b); |
| 2549 | #endif |
| 2550 | |
| 2551 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2552 | extern half3 __attribute__((const, overloadable)) |
| 2553 | max(half3 a, half3 b); |
| 2554 | #endif |
| 2555 | |
| 2556 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2557 | extern half4 __attribute__((const, overloadable)) |
| 2558 | max(half4 a, half4 b); |
| 2559 | #endif |
| 2560 | |
Jean-Luc Brouillet | 7cf263d | 2015-08-20 17:30:41 -0700 | [diff] [blame] | 2561 | extern float2 __attribute__((const, overloadable)) |
| 2562 | max(float2 a, float b); |
| 2563 | |
| 2564 | extern float3 __attribute__((const, overloadable)) |
| 2565 | max(float3 a, float b); |
| 2566 | |
| 2567 | extern float4 __attribute__((const, overloadable)) |
| 2568 | max(float4 a, float b); |
| 2569 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 2570 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2571 | extern half2 __attribute__((const, overloadable)) |
| 2572 | max(half2 a, half b); |
| 2573 | #endif |
| 2574 | |
| 2575 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2576 | extern half3 __attribute__((const, overloadable)) |
| 2577 | max(half3 a, half b); |
| 2578 | #endif |
| 2579 | |
| 2580 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 2581 | extern half4 __attribute__((const, overloadable)) |
| 2582 | max(half4 a, half b); |
| 2583 | #endif |
| 2584 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 2585 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2586 | static inline char __attribute__((const, overloadable)) |
| 2587 | max(char a, char b) { |
| 2588 | return (a > b ? a : b); |
| 2589 | } |
| 2590 | #endif |
| 2591 | |
| 2592 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2593 | static inline uchar __attribute__((const, overloadable)) |
| 2594 | max(uchar a, uchar b) { |
| 2595 | return (a > b ? a : b); |
| 2596 | } |
| 2597 | #endif |
| 2598 | |
| 2599 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2600 | static inline short __attribute__((const, overloadable)) |
| 2601 | max(short a, short b) { |
| 2602 | return (a > b ? a : b); |
| 2603 | } |
| 2604 | #endif |
| 2605 | |
| 2606 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2607 | static inline ushort __attribute__((const, overloadable)) |
| 2608 | max(ushort a, ushort b) { |
| 2609 | return (a > b ? a : b); |
| 2610 | } |
| 2611 | #endif |
| 2612 | |
| 2613 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2614 | static inline int __attribute__((const, overloadable)) |
| 2615 | max(int a, int b) { |
| 2616 | return (a > b ? a : b); |
| 2617 | } |
| 2618 | #endif |
| 2619 | |
| 2620 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2621 | static inline uint __attribute__((const, overloadable)) |
| 2622 | max(uint a, uint b) { |
| 2623 | return (a > b ? a : b); |
| 2624 | } |
| 2625 | #endif |
| 2626 | |
| 2627 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2628 | static inline char2 __attribute__((const, overloadable)) |
| 2629 | max(char2 a, char2 b) { |
| 2630 | char2 tmp; |
| 2631 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2632 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2633 | return tmp; |
| 2634 | } |
| 2635 | #endif |
| 2636 | |
| 2637 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2638 | static inline uchar2 __attribute__((const, overloadable)) |
| 2639 | max(uchar2 a, uchar2 b) { |
| 2640 | uchar2 tmp; |
| 2641 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2642 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2643 | return tmp; |
| 2644 | } |
| 2645 | #endif |
| 2646 | |
| 2647 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2648 | static inline short2 __attribute__((const, overloadable)) |
| 2649 | max(short2 a, short2 b) { |
| 2650 | short2 tmp; |
| 2651 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2652 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2653 | return tmp; |
| 2654 | } |
| 2655 | #endif |
| 2656 | |
| 2657 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2658 | static inline ushort2 __attribute__((const, overloadable)) |
| 2659 | max(ushort2 a, ushort2 b) { |
| 2660 | ushort2 tmp; |
| 2661 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2662 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2663 | return tmp; |
| 2664 | } |
| 2665 | #endif |
| 2666 | |
| 2667 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2668 | static inline int2 __attribute__((const, overloadable)) |
| 2669 | max(int2 a, int2 b) { |
| 2670 | int2 tmp; |
| 2671 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2672 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2673 | return tmp; |
| 2674 | } |
| 2675 | #endif |
| 2676 | |
| 2677 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2678 | static inline uint2 __attribute__((const, overloadable)) |
| 2679 | max(uint2 a, uint2 b) { |
| 2680 | uint2 tmp; |
| 2681 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2682 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2683 | return tmp; |
| 2684 | } |
| 2685 | #endif |
| 2686 | |
| 2687 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2688 | static inline char3 __attribute__((const, overloadable)) |
| 2689 | max(char3 a, char3 b) { |
| 2690 | char3 tmp; |
| 2691 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2692 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2693 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2694 | return tmp; |
| 2695 | } |
| 2696 | #endif |
| 2697 | |
| 2698 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2699 | static inline uchar3 __attribute__((const, overloadable)) |
| 2700 | max(uchar3 a, uchar3 b) { |
| 2701 | uchar3 tmp; |
| 2702 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2703 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2704 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2705 | return tmp; |
| 2706 | } |
| 2707 | #endif |
| 2708 | |
| 2709 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2710 | static inline short3 __attribute__((const, overloadable)) |
| 2711 | max(short3 a, short3 b) { |
| 2712 | short3 tmp; |
| 2713 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2714 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2715 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2716 | return tmp; |
| 2717 | } |
| 2718 | #endif |
| 2719 | |
| 2720 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2721 | static inline ushort3 __attribute__((const, overloadable)) |
| 2722 | max(ushort3 a, ushort3 b) { |
| 2723 | ushort3 tmp; |
| 2724 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2725 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2726 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2727 | return tmp; |
| 2728 | } |
| 2729 | #endif |
| 2730 | |
| 2731 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2732 | static inline int3 __attribute__((const, overloadable)) |
| 2733 | max(int3 a, int3 b) { |
| 2734 | int3 tmp; |
| 2735 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2736 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2737 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2738 | return tmp; |
| 2739 | } |
| 2740 | #endif |
| 2741 | |
| 2742 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2743 | static inline uint3 __attribute__((const, overloadable)) |
| 2744 | max(uint3 a, uint3 b) { |
| 2745 | uint3 tmp; |
| 2746 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2747 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2748 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2749 | return tmp; |
| 2750 | } |
| 2751 | #endif |
| 2752 | |
| 2753 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2754 | static inline char4 __attribute__((const, overloadable)) |
| 2755 | max(char4 a, char4 b) { |
| 2756 | char4 tmp; |
| 2757 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2758 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2759 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2760 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 2761 | return tmp; |
| 2762 | } |
| 2763 | #endif |
| 2764 | |
| 2765 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2766 | static inline uchar4 __attribute__((const, overloadable)) |
| 2767 | max(uchar4 a, uchar4 b) { |
| 2768 | uchar4 tmp; |
| 2769 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2770 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2771 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2772 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 2773 | return tmp; |
| 2774 | } |
| 2775 | #endif |
| 2776 | |
| 2777 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2778 | static inline short4 __attribute__((const, overloadable)) |
| 2779 | max(short4 a, short4 b) { |
| 2780 | short4 tmp; |
| 2781 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2782 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2783 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2784 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 2785 | return tmp; |
| 2786 | } |
| 2787 | #endif |
| 2788 | |
| 2789 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2790 | static inline ushort4 __attribute__((const, overloadable)) |
| 2791 | max(ushort4 a, ushort4 b) { |
| 2792 | ushort4 tmp; |
| 2793 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2794 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2795 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2796 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 2797 | return tmp; |
| 2798 | } |
| 2799 | #endif |
| 2800 | |
| 2801 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2802 | static inline int4 __attribute__((const, overloadable)) |
| 2803 | max(int4 a, int4 b) { |
| 2804 | int4 tmp; |
| 2805 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2806 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2807 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2808 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 2809 | return tmp; |
| 2810 | } |
| 2811 | #endif |
| 2812 | |
| 2813 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 2814 | static inline uint4 __attribute__((const, overloadable)) |
| 2815 | max(uint4 a, uint4 b) { |
| 2816 | uint4 tmp; |
| 2817 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 2818 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 2819 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 2820 | tmp.w = (a.w > b.w ? a.w : b.w); |
| 2821 | return tmp; |
| 2822 | } |
| 2823 | #endif |
| 2824 | |
| 2825 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2826 | extern char __attribute__((const, overloadable)) |
| 2827 | max(char a, char b); |
| 2828 | #endif |
| 2829 | |
| 2830 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2831 | extern char2 __attribute__((const, overloadable)) |
| 2832 | max(char2 a, char2 b); |
| 2833 | #endif |
| 2834 | |
| 2835 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2836 | extern char3 __attribute__((const, overloadable)) |
| 2837 | max(char3 a, char3 b); |
| 2838 | #endif |
| 2839 | |
| 2840 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2841 | extern char4 __attribute__((const, overloadable)) |
| 2842 | max(char4 a, char4 b); |
| 2843 | #endif |
| 2844 | |
| 2845 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2846 | extern uchar __attribute__((const, overloadable)) |
| 2847 | max(uchar a, uchar b); |
| 2848 | #endif |
| 2849 | |
| 2850 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2851 | extern uchar2 __attribute__((const, overloadable)) |
| 2852 | max(uchar2 a, uchar2 b); |
| 2853 | #endif |
| 2854 | |
| 2855 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2856 | extern uchar3 __attribute__((const, overloadable)) |
| 2857 | max(uchar3 a, uchar3 b); |
| 2858 | #endif |
| 2859 | |
| 2860 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2861 | extern uchar4 __attribute__((const, overloadable)) |
| 2862 | max(uchar4 a, uchar4 b); |
| 2863 | #endif |
| 2864 | |
| 2865 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2866 | extern short __attribute__((const, overloadable)) |
| 2867 | max(short a, short b); |
| 2868 | #endif |
| 2869 | |
| 2870 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2871 | extern short2 __attribute__((const, overloadable)) |
| 2872 | max(short2 a, short2 b); |
| 2873 | #endif |
| 2874 | |
| 2875 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2876 | extern short3 __attribute__((const, overloadable)) |
| 2877 | max(short3 a, short3 b); |
| 2878 | #endif |
| 2879 | |
| 2880 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2881 | extern short4 __attribute__((const, overloadable)) |
| 2882 | max(short4 a, short4 b); |
| 2883 | #endif |
| 2884 | |
| 2885 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2886 | extern ushort __attribute__((const, overloadable)) |
| 2887 | max(ushort a, ushort b); |
| 2888 | #endif |
| 2889 | |
| 2890 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2891 | extern ushort2 __attribute__((const, overloadable)) |
| 2892 | max(ushort2 a, ushort2 b); |
| 2893 | #endif |
| 2894 | |
| 2895 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2896 | extern ushort3 __attribute__((const, overloadable)) |
| 2897 | max(ushort3 a, ushort3 b); |
| 2898 | #endif |
| 2899 | |
| 2900 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2901 | extern ushort4 __attribute__((const, overloadable)) |
| 2902 | max(ushort4 a, ushort4 b); |
| 2903 | #endif |
| 2904 | |
| 2905 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2906 | extern int __attribute__((const, overloadable)) |
| 2907 | max(int a, int b); |
| 2908 | #endif |
| 2909 | |
| 2910 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2911 | extern int2 __attribute__((const, overloadable)) |
| 2912 | max(int2 a, int2 b); |
| 2913 | #endif |
| 2914 | |
| 2915 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2916 | extern int3 __attribute__((const, overloadable)) |
| 2917 | max(int3 a, int3 b); |
| 2918 | #endif |
| 2919 | |
| 2920 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2921 | extern int4 __attribute__((const, overloadable)) |
| 2922 | max(int4 a, int4 b); |
| 2923 | #endif |
| 2924 | |
| 2925 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2926 | extern uint __attribute__((const, overloadable)) |
| 2927 | max(uint a, uint b); |
| 2928 | #endif |
| 2929 | |
| 2930 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2931 | extern uint2 __attribute__((const, overloadable)) |
| 2932 | max(uint2 a, uint2 b); |
| 2933 | #endif |
| 2934 | |
| 2935 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2936 | extern uint3 __attribute__((const, overloadable)) |
| 2937 | max(uint3 a, uint3 b); |
| 2938 | #endif |
| 2939 | |
| 2940 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2941 | extern uint4 __attribute__((const, overloadable)) |
| 2942 | max(uint4 a, uint4 b); |
| 2943 | #endif |
| 2944 | |
| 2945 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2946 | extern long __attribute__((const, overloadable)) |
| 2947 | max(long a, long b); |
| 2948 | #endif |
| 2949 | |
| 2950 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2951 | extern long2 __attribute__((const, overloadable)) |
| 2952 | max(long2 a, long2 b); |
| 2953 | #endif |
| 2954 | |
| 2955 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2956 | extern long3 __attribute__((const, overloadable)) |
| 2957 | max(long3 a, long3 b); |
| 2958 | #endif |
| 2959 | |
| 2960 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2961 | extern long4 __attribute__((const, overloadable)) |
| 2962 | max(long4 a, long4 b); |
| 2963 | #endif |
| 2964 | |
| 2965 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2966 | extern ulong __attribute__((const, overloadable)) |
| 2967 | max(ulong a, ulong b); |
| 2968 | #endif |
| 2969 | |
| 2970 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2971 | extern ulong2 __attribute__((const, overloadable)) |
| 2972 | max(ulong2 a, ulong2 b); |
| 2973 | #endif |
| 2974 | |
| 2975 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2976 | extern ulong3 __attribute__((const, overloadable)) |
| 2977 | max(ulong3 a, ulong3 b); |
| 2978 | #endif |
| 2979 | |
| 2980 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 2981 | extern ulong4 __attribute__((const, overloadable)) |
| 2982 | max(ulong4 a, ulong4 b); |
| 2983 | #endif |
| 2984 | |
| 2985 | /* |
| 2986 | * min: Minimum |
| 2987 | * |
| 2988 | * Returns the minimum value of two arguments. |
| 2989 | */ |
| 2990 | extern float __attribute__((const, overloadable)) |
| 2991 | min(float a, float b); |
| 2992 | |
| 2993 | extern float2 __attribute__((const, overloadable)) |
| 2994 | min(float2 a, float2 b); |
| 2995 | |
| 2996 | extern float3 __attribute__((const, overloadable)) |
| 2997 | min(float3 a, float3 b); |
| 2998 | |
| 2999 | extern float4 __attribute__((const, overloadable)) |
| 3000 | min(float4 a, float4 b); |
| 3001 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3002 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3003 | extern half __attribute__((const, overloadable)) |
| 3004 | min(half a, half b); |
| 3005 | #endif |
| 3006 | |
| 3007 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3008 | extern half2 __attribute__((const, overloadable)) |
| 3009 | min(half2 a, half2 b); |
| 3010 | #endif |
| 3011 | |
| 3012 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3013 | extern half3 __attribute__((const, overloadable)) |
| 3014 | min(half3 a, half3 b); |
| 3015 | #endif |
| 3016 | |
| 3017 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3018 | extern half4 __attribute__((const, overloadable)) |
| 3019 | min(half4 a, half4 b); |
| 3020 | #endif |
| 3021 | |
Jean-Luc Brouillet | 7cf263d | 2015-08-20 17:30:41 -0700 | [diff] [blame] | 3022 | extern float2 __attribute__((const, overloadable)) |
| 3023 | min(float2 a, float b); |
| 3024 | |
| 3025 | extern float3 __attribute__((const, overloadable)) |
| 3026 | min(float3 a, float b); |
| 3027 | |
| 3028 | extern float4 __attribute__((const, overloadable)) |
| 3029 | min(float4 a, float b); |
| 3030 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3031 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3032 | extern half2 __attribute__((const, overloadable)) |
| 3033 | min(half2 a, half b); |
| 3034 | #endif |
| 3035 | |
| 3036 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3037 | extern half3 __attribute__((const, overloadable)) |
| 3038 | min(half3 a, half b); |
| 3039 | #endif |
| 3040 | |
| 3041 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3042 | extern half4 __attribute__((const, overloadable)) |
| 3043 | min(half4 a, half b); |
| 3044 | #endif |
| 3045 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3046 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3047 | static inline char __attribute__((const, overloadable)) |
| 3048 | min(char a, char b) { |
| 3049 | return (a < b ? a : b); |
| 3050 | } |
| 3051 | #endif |
| 3052 | |
| 3053 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3054 | static inline uchar __attribute__((const, overloadable)) |
| 3055 | min(uchar a, uchar b) { |
| 3056 | return (a < b ? a : b); |
| 3057 | } |
| 3058 | #endif |
| 3059 | |
| 3060 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3061 | static inline short __attribute__((const, overloadable)) |
| 3062 | min(short a, short b) { |
| 3063 | return (a < b ? a : b); |
| 3064 | } |
| 3065 | #endif |
| 3066 | |
| 3067 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3068 | static inline ushort __attribute__((const, overloadable)) |
| 3069 | min(ushort a, ushort b) { |
| 3070 | return (a < b ? a : b); |
| 3071 | } |
| 3072 | #endif |
| 3073 | |
| 3074 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3075 | static inline int __attribute__((const, overloadable)) |
| 3076 | min(int a, int b) { |
| 3077 | return (a < b ? a : b); |
| 3078 | } |
| 3079 | #endif |
| 3080 | |
| 3081 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3082 | static inline uint __attribute__((const, overloadable)) |
| 3083 | min(uint a, uint b) { |
| 3084 | return (a < b ? a : b); |
| 3085 | } |
| 3086 | #endif |
| 3087 | |
| 3088 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3089 | static inline char2 __attribute__((const, overloadable)) |
| 3090 | min(char2 a, char2 b) { |
| 3091 | char2 tmp; |
| 3092 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3093 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3094 | return tmp; |
| 3095 | } |
| 3096 | #endif |
| 3097 | |
| 3098 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3099 | static inline uchar2 __attribute__((const, overloadable)) |
| 3100 | min(uchar2 a, uchar2 b) { |
| 3101 | uchar2 tmp; |
| 3102 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3103 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3104 | return tmp; |
| 3105 | } |
| 3106 | #endif |
| 3107 | |
| 3108 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3109 | static inline short2 __attribute__((const, overloadable)) |
| 3110 | min(short2 a, short2 b) { |
| 3111 | short2 tmp; |
| 3112 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3113 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3114 | return tmp; |
| 3115 | } |
| 3116 | #endif |
| 3117 | |
| 3118 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3119 | static inline ushort2 __attribute__((const, overloadable)) |
| 3120 | min(ushort2 a, ushort2 b) { |
| 3121 | ushort2 tmp; |
| 3122 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3123 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3124 | return tmp; |
| 3125 | } |
| 3126 | #endif |
| 3127 | |
| 3128 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3129 | static inline int2 __attribute__((const, overloadable)) |
| 3130 | min(int2 a, int2 b) { |
| 3131 | int2 tmp; |
| 3132 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3133 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3134 | return tmp; |
| 3135 | } |
| 3136 | #endif |
| 3137 | |
| 3138 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3139 | static inline uint2 __attribute__((const, overloadable)) |
| 3140 | min(uint2 a, uint2 b) { |
| 3141 | uint2 tmp; |
| 3142 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3143 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3144 | return tmp; |
| 3145 | } |
| 3146 | #endif |
| 3147 | |
| 3148 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3149 | static inline char3 __attribute__((const, overloadable)) |
| 3150 | min(char3 a, char3 b) { |
| 3151 | char3 tmp; |
| 3152 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3153 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3154 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3155 | return tmp; |
| 3156 | } |
| 3157 | #endif |
| 3158 | |
| 3159 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3160 | static inline uchar3 __attribute__((const, overloadable)) |
| 3161 | min(uchar3 a, uchar3 b) { |
| 3162 | uchar3 tmp; |
| 3163 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3164 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3165 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3166 | return tmp; |
| 3167 | } |
| 3168 | #endif |
| 3169 | |
| 3170 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3171 | static inline short3 __attribute__((const, overloadable)) |
| 3172 | min(short3 a, short3 b) { |
| 3173 | short3 tmp; |
| 3174 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3175 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3176 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3177 | return tmp; |
| 3178 | } |
| 3179 | #endif |
| 3180 | |
| 3181 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3182 | static inline ushort3 __attribute__((const, overloadable)) |
| 3183 | min(ushort3 a, ushort3 b) { |
| 3184 | ushort3 tmp; |
| 3185 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3186 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3187 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3188 | return tmp; |
| 3189 | } |
| 3190 | #endif |
| 3191 | |
| 3192 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3193 | static inline int3 __attribute__((const, overloadable)) |
| 3194 | min(int3 a, int3 b) { |
| 3195 | int3 tmp; |
| 3196 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3197 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3198 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3199 | return tmp; |
| 3200 | } |
| 3201 | #endif |
| 3202 | |
| 3203 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3204 | static inline uint3 __attribute__((const, overloadable)) |
| 3205 | min(uint3 a, uint3 b) { |
| 3206 | uint3 tmp; |
| 3207 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3208 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3209 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3210 | return tmp; |
| 3211 | } |
| 3212 | #endif |
| 3213 | |
| 3214 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3215 | static inline char4 __attribute__((const, overloadable)) |
| 3216 | min(char4 a, char4 b) { |
| 3217 | char4 tmp; |
| 3218 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3219 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3220 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3221 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 3222 | return tmp; |
| 3223 | } |
| 3224 | #endif |
| 3225 | |
| 3226 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3227 | static inline uchar4 __attribute__((const, overloadable)) |
| 3228 | min(uchar4 a, uchar4 b) { |
| 3229 | uchar4 tmp; |
| 3230 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3231 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3232 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3233 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 3234 | return tmp; |
| 3235 | } |
| 3236 | #endif |
| 3237 | |
| 3238 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3239 | static inline short4 __attribute__((const, overloadable)) |
| 3240 | min(short4 a, short4 b) { |
| 3241 | short4 tmp; |
| 3242 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3243 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3244 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3245 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 3246 | return tmp; |
| 3247 | } |
| 3248 | #endif |
| 3249 | |
| 3250 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3251 | static inline ushort4 __attribute__((const, overloadable)) |
| 3252 | min(ushort4 a, ushort4 b) { |
| 3253 | ushort4 tmp; |
| 3254 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3255 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3256 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3257 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 3258 | return tmp; |
| 3259 | } |
| 3260 | #endif |
| 3261 | |
| 3262 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3263 | static inline int4 __attribute__((const, overloadable)) |
| 3264 | min(int4 a, int4 b) { |
| 3265 | int4 tmp; |
| 3266 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3267 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3268 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3269 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 3270 | return tmp; |
| 3271 | } |
| 3272 | #endif |
| 3273 | |
| 3274 | #if !defined(RS_VERSION) || (RS_VERSION <= 20) |
| 3275 | static inline uint4 __attribute__((const, overloadable)) |
| 3276 | min(uint4 a, uint4 b) { |
| 3277 | uint4 tmp; |
| 3278 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 3279 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 3280 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 3281 | tmp.w = (a.w < b.w ? a.w : b.w); |
| 3282 | return tmp; |
| 3283 | } |
| 3284 | #endif |
| 3285 | |
| 3286 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3287 | extern char __attribute__((const, overloadable)) |
| 3288 | min(char a, char b); |
| 3289 | #endif |
| 3290 | |
| 3291 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3292 | extern char2 __attribute__((const, overloadable)) |
| 3293 | min(char2 a, char2 b); |
| 3294 | #endif |
| 3295 | |
| 3296 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3297 | extern char3 __attribute__((const, overloadable)) |
| 3298 | min(char3 a, char3 b); |
| 3299 | #endif |
| 3300 | |
| 3301 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3302 | extern char4 __attribute__((const, overloadable)) |
| 3303 | min(char4 a, char4 b); |
| 3304 | #endif |
| 3305 | |
| 3306 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3307 | extern uchar __attribute__((const, overloadable)) |
| 3308 | min(uchar a, uchar b); |
| 3309 | #endif |
| 3310 | |
| 3311 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3312 | extern uchar2 __attribute__((const, overloadable)) |
| 3313 | min(uchar2 a, uchar2 b); |
| 3314 | #endif |
| 3315 | |
| 3316 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3317 | extern uchar3 __attribute__((const, overloadable)) |
| 3318 | min(uchar3 a, uchar3 b); |
| 3319 | #endif |
| 3320 | |
| 3321 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3322 | extern uchar4 __attribute__((const, overloadable)) |
| 3323 | min(uchar4 a, uchar4 b); |
| 3324 | #endif |
| 3325 | |
| 3326 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3327 | extern short __attribute__((const, overloadable)) |
| 3328 | min(short a, short b); |
| 3329 | #endif |
| 3330 | |
| 3331 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3332 | extern short2 __attribute__((const, overloadable)) |
| 3333 | min(short2 a, short2 b); |
| 3334 | #endif |
| 3335 | |
| 3336 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3337 | extern short3 __attribute__((const, overloadable)) |
| 3338 | min(short3 a, short3 b); |
| 3339 | #endif |
| 3340 | |
| 3341 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3342 | extern short4 __attribute__((const, overloadable)) |
| 3343 | min(short4 a, short4 b); |
| 3344 | #endif |
| 3345 | |
| 3346 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3347 | extern ushort __attribute__((const, overloadable)) |
| 3348 | min(ushort a, ushort b); |
| 3349 | #endif |
| 3350 | |
| 3351 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3352 | extern ushort2 __attribute__((const, overloadable)) |
| 3353 | min(ushort2 a, ushort2 b); |
| 3354 | #endif |
| 3355 | |
| 3356 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3357 | extern ushort3 __attribute__((const, overloadable)) |
| 3358 | min(ushort3 a, ushort3 b); |
| 3359 | #endif |
| 3360 | |
| 3361 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3362 | extern ushort4 __attribute__((const, overloadable)) |
| 3363 | min(ushort4 a, ushort4 b); |
| 3364 | #endif |
| 3365 | |
| 3366 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3367 | extern int __attribute__((const, overloadable)) |
| 3368 | min(int a, int b); |
| 3369 | #endif |
| 3370 | |
| 3371 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3372 | extern int2 __attribute__((const, overloadable)) |
| 3373 | min(int2 a, int2 b); |
| 3374 | #endif |
| 3375 | |
| 3376 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3377 | extern int3 __attribute__((const, overloadable)) |
| 3378 | min(int3 a, int3 b); |
| 3379 | #endif |
| 3380 | |
| 3381 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3382 | extern int4 __attribute__((const, overloadable)) |
| 3383 | min(int4 a, int4 b); |
| 3384 | #endif |
| 3385 | |
| 3386 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3387 | extern uint __attribute__((const, overloadable)) |
| 3388 | min(uint a, uint b); |
| 3389 | #endif |
| 3390 | |
| 3391 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3392 | extern uint2 __attribute__((const, overloadable)) |
| 3393 | min(uint2 a, uint2 b); |
| 3394 | #endif |
| 3395 | |
| 3396 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3397 | extern uint3 __attribute__((const, overloadable)) |
| 3398 | min(uint3 a, uint3 b); |
| 3399 | #endif |
| 3400 | |
| 3401 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3402 | extern uint4 __attribute__((const, overloadable)) |
| 3403 | min(uint4 a, uint4 b); |
| 3404 | #endif |
| 3405 | |
| 3406 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3407 | extern long __attribute__((const, overloadable)) |
| 3408 | min(long a, long b); |
| 3409 | #endif |
| 3410 | |
| 3411 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3412 | extern long2 __attribute__((const, overloadable)) |
| 3413 | min(long2 a, long2 b); |
| 3414 | #endif |
| 3415 | |
| 3416 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3417 | extern long3 __attribute__((const, overloadable)) |
| 3418 | min(long3 a, long3 b); |
| 3419 | #endif |
| 3420 | |
| 3421 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3422 | extern long4 __attribute__((const, overloadable)) |
| 3423 | min(long4 a, long4 b); |
| 3424 | #endif |
| 3425 | |
| 3426 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3427 | extern ulong __attribute__((const, overloadable)) |
| 3428 | min(ulong a, ulong b); |
| 3429 | #endif |
| 3430 | |
| 3431 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3432 | extern ulong2 __attribute__((const, overloadable)) |
| 3433 | min(ulong2 a, ulong2 b); |
| 3434 | #endif |
| 3435 | |
| 3436 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3437 | extern ulong3 __attribute__((const, overloadable)) |
| 3438 | min(ulong3 a, ulong3 b); |
| 3439 | #endif |
| 3440 | |
| 3441 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3442 | extern ulong4 __attribute__((const, overloadable)) |
| 3443 | min(ulong4 a, ulong4 b); |
| 3444 | #endif |
| 3445 | |
| 3446 | /* |
| 3447 | * mix: Mixes two values |
| 3448 | * |
| 3449 | * Returns start + ((stop - start) * fraction). |
| 3450 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3451 | * This can be useful for mixing two values. For example, to create a new color that is |
| 3452 | * 40% color1 and 60% color2, use mix(color1, color2, 0.6f). |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3453 | */ |
| 3454 | extern float __attribute__((const, overloadable)) |
| 3455 | mix(float start, float stop, float fraction); |
| 3456 | |
| 3457 | extern float2 __attribute__((const, overloadable)) |
| 3458 | mix(float2 start, float2 stop, float2 fraction); |
| 3459 | |
| 3460 | extern float3 __attribute__((const, overloadable)) |
| 3461 | mix(float3 start, float3 stop, float3 fraction); |
| 3462 | |
| 3463 | extern float4 __attribute__((const, overloadable)) |
| 3464 | mix(float4 start, float4 stop, float4 fraction); |
| 3465 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3466 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3467 | extern half __attribute__((const, overloadable)) |
| 3468 | mix(half start, half stop, half fraction); |
| 3469 | #endif |
| 3470 | |
| 3471 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3472 | extern half2 __attribute__((const, overloadable)) |
| 3473 | mix(half2 start, half2 stop, half2 fraction); |
| 3474 | #endif |
| 3475 | |
| 3476 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3477 | extern half3 __attribute__((const, overloadable)) |
| 3478 | mix(half3 start, half3 stop, half3 fraction); |
| 3479 | #endif |
| 3480 | |
| 3481 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3482 | extern half4 __attribute__((const, overloadable)) |
| 3483 | mix(half4 start, half4 stop, half4 fraction); |
| 3484 | #endif |
| 3485 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3486 | extern float2 __attribute__((const, overloadable)) |
| 3487 | mix(float2 start, float2 stop, float fraction); |
| 3488 | |
| 3489 | extern float3 __attribute__((const, overloadable)) |
| 3490 | mix(float3 start, float3 stop, float fraction); |
| 3491 | |
| 3492 | extern float4 __attribute__((const, overloadable)) |
| 3493 | mix(float4 start, float4 stop, float fraction); |
| 3494 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3495 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3496 | extern half2 __attribute__((const, overloadable)) |
| 3497 | mix(half2 start, half2 stop, half fraction); |
| 3498 | #endif |
| 3499 | |
| 3500 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3501 | extern half3 __attribute__((const, overloadable)) |
| 3502 | mix(half3 start, half3 stop, half fraction); |
| 3503 | #endif |
| 3504 | |
| 3505 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3506 | extern half4 __attribute__((const, overloadable)) |
| 3507 | mix(half4 start, half4 stop, half fraction); |
| 3508 | #endif |
| 3509 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3510 | /* |
| 3511 | * modf: Integral and fractional components |
| 3512 | * |
| 3513 | * Returns the integral and fractional components of a number. |
| 3514 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3515 | * 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] | 3516 | * *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] | 3517 | * |
| 3518 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3519 | * v: Source value. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 3520 | * 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] | 3521 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3522 | * Returns: Floating point portion of the value. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3523 | */ |
| 3524 | extern float __attribute__((overloadable)) |
| 3525 | modf(float v, float* integral_part); |
| 3526 | |
| 3527 | extern float2 __attribute__((overloadable)) |
| 3528 | modf(float2 v, float2* integral_part); |
| 3529 | |
| 3530 | extern float3 __attribute__((overloadable)) |
| 3531 | modf(float3 v, float3* integral_part); |
| 3532 | |
| 3533 | extern float4 __attribute__((overloadable)) |
| 3534 | modf(float4 v, float4* integral_part); |
| 3535 | |
| 3536 | /* |
| 3537 | * nan: Not a Number |
| 3538 | * |
| 3539 | * Returns a NaN value (Not a Number). |
| 3540 | * |
| 3541 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 3542 | * v: Not used. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3543 | */ |
| 3544 | extern float __attribute__((const, overloadable)) |
| 3545 | nan(uint v); |
| 3546 | |
| 3547 | /* |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3548 | * nan_half: Not a Number |
| 3549 | * |
| 3550 | * Returns a half-precision floating point NaN value (Not a Number). |
| 3551 | */ |
| 3552 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 4294967295)) |
| 3553 | extern half __attribute__((const, overloadable)) |
| 3554 | nan_half(void); |
| 3555 | #endif |
| 3556 | |
| 3557 | /* |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3558 | * native_acos: Approximate inverse cosine |
| 3559 | * |
| 3560 | * Returns the approximate inverse cosine, in radians. |
| 3561 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3562 | * 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] | 3563 | * |
| 3564 | * See also acos(). |
| 3565 | */ |
| 3566 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3567 | extern float __attribute__((const, overloadable)) |
| 3568 | native_acos(float v); |
| 3569 | #endif |
| 3570 | |
| 3571 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3572 | extern float2 __attribute__((const, overloadable)) |
| 3573 | native_acos(float2 v); |
| 3574 | #endif |
| 3575 | |
| 3576 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3577 | extern float3 __attribute__((const, overloadable)) |
| 3578 | native_acos(float3 v); |
| 3579 | #endif |
| 3580 | |
| 3581 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3582 | extern float4 __attribute__((const, overloadable)) |
| 3583 | native_acos(float4 v); |
| 3584 | #endif |
| 3585 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3586 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3587 | extern half __attribute__((const, overloadable)) |
| 3588 | native_acos(half v); |
| 3589 | #endif |
| 3590 | |
| 3591 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3592 | extern half2 __attribute__((const, overloadable)) |
| 3593 | native_acos(half2 v); |
| 3594 | #endif |
| 3595 | |
| 3596 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3597 | extern half3 __attribute__((const, overloadable)) |
| 3598 | native_acos(half3 v); |
| 3599 | #endif |
| 3600 | |
| 3601 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3602 | extern half4 __attribute__((const, overloadable)) |
| 3603 | native_acos(half4 v); |
| 3604 | #endif |
| 3605 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3606 | /* |
| 3607 | * native_acosh: Approximate inverse hyperbolic cosine |
| 3608 | * |
| 3609 | * Returns the approximate inverse hyperbolic cosine, in radians. |
| 3610 | * |
| 3611 | * See also acosh(). |
| 3612 | */ |
| 3613 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3614 | extern float __attribute__((const, overloadable)) |
| 3615 | native_acosh(float v); |
| 3616 | #endif |
| 3617 | |
| 3618 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3619 | extern float2 __attribute__((const, overloadable)) |
| 3620 | native_acosh(float2 v); |
| 3621 | #endif |
| 3622 | |
| 3623 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3624 | extern float3 __attribute__((const, overloadable)) |
| 3625 | native_acosh(float3 v); |
| 3626 | #endif |
| 3627 | |
| 3628 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3629 | extern float4 __attribute__((const, overloadable)) |
| 3630 | native_acosh(float4 v); |
| 3631 | #endif |
| 3632 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3633 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3634 | extern half __attribute__((const, overloadable)) |
| 3635 | native_acosh(half v); |
| 3636 | #endif |
| 3637 | |
| 3638 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3639 | extern half2 __attribute__((const, overloadable)) |
| 3640 | native_acosh(half2 v); |
| 3641 | #endif |
| 3642 | |
| 3643 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3644 | extern half3 __attribute__((const, overloadable)) |
| 3645 | native_acosh(half3 v); |
| 3646 | #endif |
| 3647 | |
| 3648 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3649 | extern half4 __attribute__((const, overloadable)) |
| 3650 | native_acosh(half4 v); |
| 3651 | #endif |
| 3652 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3653 | /* |
| 3654 | * native_acospi: Approximate inverse cosine divided by pi |
| 3655 | * |
| 3656 | * Returns the approximate inverse cosine in radians, divided by pi. |
| 3657 | * |
| 3658 | * To get an inverse cosine measured in degrees, use acospi(a) * 180.f. |
| 3659 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3660 | * 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] | 3661 | * |
| 3662 | * See also acospi(). |
| 3663 | */ |
| 3664 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3665 | extern float __attribute__((const, overloadable)) |
| 3666 | native_acospi(float v); |
| 3667 | #endif |
| 3668 | |
| 3669 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3670 | extern float2 __attribute__((const, overloadable)) |
| 3671 | native_acospi(float2 v); |
| 3672 | #endif |
| 3673 | |
| 3674 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3675 | extern float3 __attribute__((const, overloadable)) |
| 3676 | native_acospi(float3 v); |
| 3677 | #endif |
| 3678 | |
| 3679 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3680 | extern float4 __attribute__((const, overloadable)) |
| 3681 | native_acospi(float4 v); |
| 3682 | #endif |
| 3683 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3684 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3685 | extern half __attribute__((const, overloadable)) |
| 3686 | native_acospi(half v); |
| 3687 | #endif |
| 3688 | |
| 3689 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3690 | extern half2 __attribute__((const, overloadable)) |
| 3691 | native_acospi(half2 v); |
| 3692 | #endif |
| 3693 | |
| 3694 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3695 | extern half3 __attribute__((const, overloadable)) |
| 3696 | native_acospi(half3 v); |
| 3697 | #endif |
| 3698 | |
| 3699 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3700 | extern half4 __attribute__((const, overloadable)) |
| 3701 | native_acospi(half4 v); |
| 3702 | #endif |
| 3703 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3704 | /* |
| 3705 | * native_asin: Approximate inverse sine |
| 3706 | * |
| 3707 | * Returns the approximate inverse sine, in radians. |
| 3708 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3709 | * 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] | 3710 | * |
| 3711 | * See also asin(). |
| 3712 | */ |
| 3713 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3714 | extern float __attribute__((const, overloadable)) |
| 3715 | native_asin(float v); |
| 3716 | #endif |
| 3717 | |
| 3718 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3719 | extern float2 __attribute__((const, overloadable)) |
| 3720 | native_asin(float2 v); |
| 3721 | #endif |
| 3722 | |
| 3723 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3724 | extern float3 __attribute__((const, overloadable)) |
| 3725 | native_asin(float3 v); |
| 3726 | #endif |
| 3727 | |
| 3728 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3729 | extern float4 __attribute__((const, overloadable)) |
| 3730 | native_asin(float4 v); |
| 3731 | #endif |
| 3732 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3733 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3734 | extern half __attribute__((const, overloadable)) |
| 3735 | native_asin(half v); |
| 3736 | #endif |
| 3737 | |
| 3738 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3739 | extern half2 __attribute__((const, overloadable)) |
| 3740 | native_asin(half2 v); |
| 3741 | #endif |
| 3742 | |
| 3743 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3744 | extern half3 __attribute__((const, overloadable)) |
| 3745 | native_asin(half3 v); |
| 3746 | #endif |
| 3747 | |
| 3748 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3749 | extern half4 __attribute__((const, overloadable)) |
| 3750 | native_asin(half4 v); |
| 3751 | #endif |
| 3752 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3753 | /* |
| 3754 | * native_asinh: Approximate inverse hyperbolic sine |
| 3755 | * |
| 3756 | * Returns the approximate inverse hyperbolic sine, in radians. |
| 3757 | * |
| 3758 | * See also asinh(). |
| 3759 | */ |
| 3760 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3761 | extern float __attribute__((const, overloadable)) |
| 3762 | native_asinh(float v); |
| 3763 | #endif |
| 3764 | |
| 3765 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3766 | extern float2 __attribute__((const, overloadable)) |
| 3767 | native_asinh(float2 v); |
| 3768 | #endif |
| 3769 | |
| 3770 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3771 | extern float3 __attribute__((const, overloadable)) |
| 3772 | native_asinh(float3 v); |
| 3773 | #endif |
| 3774 | |
| 3775 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3776 | extern float4 __attribute__((const, overloadable)) |
| 3777 | native_asinh(float4 v); |
| 3778 | #endif |
| 3779 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3780 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3781 | extern half __attribute__((const, overloadable)) |
| 3782 | native_asinh(half v); |
| 3783 | #endif |
| 3784 | |
| 3785 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3786 | extern half2 __attribute__((const, overloadable)) |
| 3787 | native_asinh(half2 v); |
| 3788 | #endif |
| 3789 | |
| 3790 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3791 | extern half3 __attribute__((const, overloadable)) |
| 3792 | native_asinh(half3 v); |
| 3793 | #endif |
| 3794 | |
| 3795 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3796 | extern half4 __attribute__((const, overloadable)) |
| 3797 | native_asinh(half4 v); |
| 3798 | #endif |
| 3799 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3800 | /* |
| 3801 | * native_asinpi: Approximate inverse sine divided by pi |
| 3802 | * |
| 3803 | * Returns the approximate inverse sine in radians, divided by pi. |
| 3804 | * |
| 3805 | * To get an inverse sine measured in degrees, use asinpi(a) * 180.f. |
| 3806 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3807 | * 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] | 3808 | * |
| 3809 | * See also asinpi(). |
| 3810 | */ |
| 3811 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3812 | extern float __attribute__((const, overloadable)) |
| 3813 | native_asinpi(float v); |
| 3814 | #endif |
| 3815 | |
| 3816 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3817 | extern float2 __attribute__((const, overloadable)) |
| 3818 | native_asinpi(float2 v); |
| 3819 | #endif |
| 3820 | |
| 3821 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3822 | extern float3 __attribute__((const, overloadable)) |
| 3823 | native_asinpi(float3 v); |
| 3824 | #endif |
| 3825 | |
| 3826 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3827 | extern float4 __attribute__((const, overloadable)) |
| 3828 | native_asinpi(float4 v); |
| 3829 | #endif |
| 3830 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3831 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3832 | extern half __attribute__((const, overloadable)) |
| 3833 | native_asinpi(half v); |
| 3834 | #endif |
| 3835 | |
| 3836 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3837 | extern half2 __attribute__((const, overloadable)) |
| 3838 | native_asinpi(half2 v); |
| 3839 | #endif |
| 3840 | |
| 3841 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3842 | extern half3 __attribute__((const, overloadable)) |
| 3843 | native_asinpi(half3 v); |
| 3844 | #endif |
| 3845 | |
| 3846 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3847 | extern half4 __attribute__((const, overloadable)) |
| 3848 | native_asinpi(half4 v); |
| 3849 | #endif |
| 3850 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3851 | /* |
| 3852 | * native_atan: Approximate inverse tangent |
| 3853 | * |
| 3854 | * Returns the approximate inverse tangent, in radians. |
| 3855 | * |
| 3856 | * See also atan(). |
| 3857 | */ |
| 3858 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3859 | extern float __attribute__((const, overloadable)) |
| 3860 | native_atan(float v); |
| 3861 | #endif |
| 3862 | |
| 3863 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3864 | extern float2 __attribute__((const, overloadable)) |
| 3865 | native_atan(float2 v); |
| 3866 | #endif |
| 3867 | |
| 3868 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3869 | extern float3 __attribute__((const, overloadable)) |
| 3870 | native_atan(float3 v); |
| 3871 | #endif |
| 3872 | |
| 3873 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3874 | extern float4 __attribute__((const, overloadable)) |
| 3875 | native_atan(float4 v); |
| 3876 | #endif |
| 3877 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3878 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3879 | extern half __attribute__((const, overloadable)) |
| 3880 | native_atan(half v); |
| 3881 | #endif |
| 3882 | |
| 3883 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3884 | extern half2 __attribute__((const, overloadable)) |
| 3885 | native_atan(half2 v); |
| 3886 | #endif |
| 3887 | |
| 3888 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3889 | extern half3 __attribute__((const, overloadable)) |
| 3890 | native_atan(half3 v); |
| 3891 | #endif |
| 3892 | |
| 3893 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3894 | extern half4 __attribute__((const, overloadable)) |
| 3895 | native_atan(half4 v); |
| 3896 | #endif |
| 3897 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3898 | /* |
| 3899 | * native_atan2: Approximate inverse tangent of a ratio |
| 3900 | * |
| 3901 | * Returns the approximate inverse tangent of (numerator / denominator), in radians. |
| 3902 | * |
| 3903 | * See also atan2(). |
| 3904 | * |
| 3905 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3906 | * numerator: Numerator. |
| 3907 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3908 | */ |
| 3909 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3910 | extern float __attribute__((const, overloadable)) |
| 3911 | native_atan2(float numerator, float denominator); |
| 3912 | #endif |
| 3913 | |
| 3914 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3915 | extern float2 __attribute__((const, overloadable)) |
| 3916 | native_atan2(float2 numerator, float2 denominator); |
| 3917 | #endif |
| 3918 | |
| 3919 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3920 | extern float3 __attribute__((const, overloadable)) |
| 3921 | native_atan2(float3 numerator, float3 denominator); |
| 3922 | #endif |
| 3923 | |
| 3924 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3925 | extern float4 __attribute__((const, overloadable)) |
| 3926 | native_atan2(float4 numerator, float4 denominator); |
| 3927 | #endif |
| 3928 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3929 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3930 | extern half __attribute__((const, overloadable)) |
| 3931 | native_atan2(half numerator, half denominator); |
| 3932 | #endif |
| 3933 | |
| 3934 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3935 | extern half2 __attribute__((const, overloadable)) |
| 3936 | native_atan2(half2 numerator, half2 denominator); |
| 3937 | #endif |
| 3938 | |
| 3939 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3940 | extern half3 __attribute__((const, overloadable)) |
| 3941 | native_atan2(half3 numerator, half3 denominator); |
| 3942 | #endif |
| 3943 | |
| 3944 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3945 | extern half4 __attribute__((const, overloadable)) |
| 3946 | native_atan2(half4 numerator, half4 denominator); |
| 3947 | #endif |
| 3948 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3949 | /* |
| 3950 | * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi |
| 3951 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3952 | * Returns the approximate inverse tangent of (numerator / denominator), |
| 3953 | * in radians, divided by pi. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3954 | * |
| 3955 | * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f. |
| 3956 | * |
| 3957 | * See also atan2pi(). |
| 3958 | * |
| 3959 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 3960 | * numerator: Numerator. |
| 3961 | * denominator: Denominator. Can be 0. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 3962 | */ |
| 3963 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3964 | extern float __attribute__((const, overloadable)) |
| 3965 | native_atan2pi(float numerator, float denominator); |
| 3966 | #endif |
| 3967 | |
| 3968 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3969 | extern float2 __attribute__((const, overloadable)) |
| 3970 | native_atan2pi(float2 numerator, float2 denominator); |
| 3971 | #endif |
| 3972 | |
| 3973 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3974 | extern float3 __attribute__((const, overloadable)) |
| 3975 | native_atan2pi(float3 numerator, float3 denominator); |
| 3976 | #endif |
| 3977 | |
| 3978 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 3979 | extern float4 __attribute__((const, overloadable)) |
| 3980 | native_atan2pi(float4 numerator, float4 denominator); |
| 3981 | #endif |
| 3982 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 3983 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3984 | extern half __attribute__((const, overloadable)) |
| 3985 | native_atan2pi(half numerator, half denominator); |
| 3986 | #endif |
| 3987 | |
| 3988 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3989 | extern half2 __attribute__((const, overloadable)) |
| 3990 | native_atan2pi(half2 numerator, half2 denominator); |
| 3991 | #endif |
| 3992 | |
| 3993 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3994 | extern half3 __attribute__((const, overloadable)) |
| 3995 | native_atan2pi(half3 numerator, half3 denominator); |
| 3996 | #endif |
| 3997 | |
| 3998 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 3999 | extern half4 __attribute__((const, overloadable)) |
| 4000 | native_atan2pi(half4 numerator, half4 denominator); |
| 4001 | #endif |
| 4002 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4003 | /* |
| 4004 | * native_atanh: Approximate inverse hyperbolic tangent |
| 4005 | * |
| 4006 | * Returns the approximate inverse hyperbolic tangent, in radians. |
| 4007 | * |
| 4008 | * See also atanh(). |
| 4009 | */ |
| 4010 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4011 | extern float __attribute__((const, overloadable)) |
| 4012 | native_atanh(float v); |
| 4013 | #endif |
| 4014 | |
| 4015 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4016 | extern float2 __attribute__((const, overloadable)) |
| 4017 | native_atanh(float2 v); |
| 4018 | #endif |
| 4019 | |
| 4020 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4021 | extern float3 __attribute__((const, overloadable)) |
| 4022 | native_atanh(float3 v); |
| 4023 | #endif |
| 4024 | |
| 4025 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4026 | extern float4 __attribute__((const, overloadable)) |
| 4027 | native_atanh(float4 v); |
| 4028 | #endif |
| 4029 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4030 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4031 | extern half __attribute__((const, overloadable)) |
| 4032 | native_atanh(half v); |
| 4033 | #endif |
| 4034 | |
| 4035 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4036 | extern half2 __attribute__((const, overloadable)) |
| 4037 | native_atanh(half2 v); |
| 4038 | #endif |
| 4039 | |
| 4040 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4041 | extern half3 __attribute__((const, overloadable)) |
| 4042 | native_atanh(half3 v); |
| 4043 | #endif |
| 4044 | |
| 4045 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4046 | extern half4 __attribute__((const, overloadable)) |
| 4047 | native_atanh(half4 v); |
| 4048 | #endif |
| 4049 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4050 | /* |
| 4051 | * native_atanpi: Approximate inverse tangent divided by pi |
| 4052 | * |
| 4053 | * Returns the approximate inverse tangent in radians, divided by pi. |
| 4054 | * |
| 4055 | * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f. |
| 4056 | * |
| 4057 | * See also atanpi(). |
| 4058 | */ |
| 4059 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4060 | extern float __attribute__((const, overloadable)) |
| 4061 | native_atanpi(float v); |
| 4062 | #endif |
| 4063 | |
| 4064 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4065 | extern float2 __attribute__((const, overloadable)) |
| 4066 | native_atanpi(float2 v); |
| 4067 | #endif |
| 4068 | |
| 4069 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4070 | extern float3 __attribute__((const, overloadable)) |
| 4071 | native_atanpi(float3 v); |
| 4072 | #endif |
| 4073 | |
| 4074 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4075 | extern float4 __attribute__((const, overloadable)) |
| 4076 | native_atanpi(float4 v); |
| 4077 | #endif |
| 4078 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4079 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4080 | extern half __attribute__((const, overloadable)) |
| 4081 | native_atanpi(half v); |
| 4082 | #endif |
| 4083 | |
| 4084 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4085 | extern half2 __attribute__((const, overloadable)) |
| 4086 | native_atanpi(half2 v); |
| 4087 | #endif |
| 4088 | |
| 4089 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4090 | extern half3 __attribute__((const, overloadable)) |
| 4091 | native_atanpi(half3 v); |
| 4092 | #endif |
| 4093 | |
| 4094 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4095 | extern half4 __attribute__((const, overloadable)) |
| 4096 | native_atanpi(half4 v); |
| 4097 | #endif |
| 4098 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4099 | /* |
| 4100 | * native_cbrt: Approximate cube root |
| 4101 | * |
| 4102 | * Returns the approximate cubic root. |
| 4103 | * |
| 4104 | * See also cbrt(). |
| 4105 | */ |
| 4106 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4107 | extern float __attribute__((const, overloadable)) |
| 4108 | native_cbrt(float v); |
| 4109 | #endif |
| 4110 | |
| 4111 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4112 | extern float2 __attribute__((const, overloadable)) |
| 4113 | native_cbrt(float2 v); |
| 4114 | #endif |
| 4115 | |
| 4116 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4117 | extern float3 __attribute__((const, overloadable)) |
| 4118 | native_cbrt(float3 v); |
| 4119 | #endif |
| 4120 | |
| 4121 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4122 | extern float4 __attribute__((const, overloadable)) |
| 4123 | native_cbrt(float4 v); |
| 4124 | #endif |
| 4125 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4126 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4127 | extern half __attribute__((const, overloadable)) |
| 4128 | native_cbrt(half v); |
| 4129 | #endif |
| 4130 | |
| 4131 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4132 | extern half2 __attribute__((const, overloadable)) |
| 4133 | native_cbrt(half2 v); |
| 4134 | #endif |
| 4135 | |
| 4136 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4137 | extern half3 __attribute__((const, overloadable)) |
| 4138 | native_cbrt(half3 v); |
| 4139 | #endif |
| 4140 | |
| 4141 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4142 | extern half4 __attribute__((const, overloadable)) |
| 4143 | native_cbrt(half4 v); |
| 4144 | #endif |
| 4145 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4146 | /* |
| 4147 | * native_cos: Approximate cosine |
| 4148 | * |
| 4149 | * Returns the approximate cosine of an angle measured in radians. |
| 4150 | * |
| 4151 | * See also cos(). |
| 4152 | */ |
| 4153 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4154 | extern float __attribute__((const, overloadable)) |
| 4155 | native_cos(float v); |
| 4156 | #endif |
| 4157 | |
| 4158 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4159 | extern float2 __attribute__((const, overloadable)) |
| 4160 | native_cos(float2 v); |
| 4161 | #endif |
| 4162 | |
| 4163 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4164 | extern float3 __attribute__((const, overloadable)) |
| 4165 | native_cos(float3 v); |
| 4166 | #endif |
| 4167 | |
| 4168 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4169 | extern float4 __attribute__((const, overloadable)) |
| 4170 | native_cos(float4 v); |
| 4171 | #endif |
| 4172 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4173 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4174 | extern half __attribute__((const, overloadable)) |
| 4175 | native_cos(half v); |
| 4176 | #endif |
| 4177 | |
| 4178 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4179 | extern half2 __attribute__((const, overloadable)) |
| 4180 | native_cos(half2 v); |
| 4181 | #endif |
| 4182 | |
| 4183 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4184 | extern half3 __attribute__((const, overloadable)) |
| 4185 | native_cos(half3 v); |
| 4186 | #endif |
| 4187 | |
| 4188 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4189 | extern half4 __attribute__((const, overloadable)) |
| 4190 | native_cos(half4 v); |
| 4191 | #endif |
| 4192 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4193 | /* |
| 4194 | * native_cosh: Approximate hypebolic cosine |
| 4195 | * |
| 4196 | * Returns the approximate hypebolic cosine. |
| 4197 | * |
| 4198 | * See also cosh(). |
| 4199 | */ |
| 4200 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4201 | extern float __attribute__((const, overloadable)) |
| 4202 | native_cosh(float v); |
| 4203 | #endif |
| 4204 | |
| 4205 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4206 | extern float2 __attribute__((const, overloadable)) |
| 4207 | native_cosh(float2 v); |
| 4208 | #endif |
| 4209 | |
| 4210 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4211 | extern float3 __attribute__((const, overloadable)) |
| 4212 | native_cosh(float3 v); |
| 4213 | #endif |
| 4214 | |
| 4215 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4216 | extern float4 __attribute__((const, overloadable)) |
| 4217 | native_cosh(float4 v); |
| 4218 | #endif |
| 4219 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4220 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4221 | extern half __attribute__((const, overloadable)) |
| 4222 | native_cosh(half v); |
| 4223 | #endif |
| 4224 | |
| 4225 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4226 | extern half2 __attribute__((const, overloadable)) |
| 4227 | native_cosh(half2 v); |
| 4228 | #endif |
| 4229 | |
| 4230 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4231 | extern half3 __attribute__((const, overloadable)) |
| 4232 | native_cosh(half3 v); |
| 4233 | #endif |
| 4234 | |
| 4235 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4236 | extern half4 __attribute__((const, overloadable)) |
| 4237 | native_cosh(half4 v); |
| 4238 | #endif |
| 4239 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4240 | /* |
| 4241 | * native_cospi: Approximate cosine of a number multiplied by pi |
| 4242 | * |
| 4243 | * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians. |
| 4244 | * |
| 4245 | * To get the cosine of a value measured in degrees, call cospi(v / 180.f). |
| 4246 | * |
| 4247 | * See also cospi(). |
| 4248 | */ |
| 4249 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4250 | extern float __attribute__((const, overloadable)) |
| 4251 | native_cospi(float v); |
| 4252 | #endif |
| 4253 | |
| 4254 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4255 | extern float2 __attribute__((const, overloadable)) |
| 4256 | native_cospi(float2 v); |
| 4257 | #endif |
| 4258 | |
| 4259 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4260 | extern float3 __attribute__((const, overloadable)) |
| 4261 | native_cospi(float3 v); |
| 4262 | #endif |
| 4263 | |
| 4264 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4265 | extern float4 __attribute__((const, overloadable)) |
| 4266 | native_cospi(float4 v); |
| 4267 | #endif |
| 4268 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4269 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4270 | extern half __attribute__((const, overloadable)) |
| 4271 | native_cospi(half v); |
| 4272 | #endif |
| 4273 | |
| 4274 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4275 | extern half2 __attribute__((const, overloadable)) |
| 4276 | native_cospi(half2 v); |
| 4277 | #endif |
| 4278 | |
| 4279 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4280 | extern half3 __attribute__((const, overloadable)) |
| 4281 | native_cospi(half3 v); |
| 4282 | #endif |
| 4283 | |
| 4284 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4285 | extern half4 __attribute__((const, overloadable)) |
| 4286 | native_cospi(half4 v); |
| 4287 | #endif |
| 4288 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4289 | /* |
| 4290 | * native_divide: Approximate division |
| 4291 | * |
| 4292 | * Computes the approximate division of two values. |
| 4293 | */ |
| 4294 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4295 | extern float __attribute__((const, overloadable)) |
| 4296 | native_divide(float left_vector, float right_vector); |
| 4297 | #endif |
| 4298 | |
| 4299 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4300 | extern float2 __attribute__((const, overloadable)) |
| 4301 | native_divide(float2 left_vector, float2 right_vector); |
| 4302 | #endif |
| 4303 | |
| 4304 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4305 | extern float3 __attribute__((const, overloadable)) |
| 4306 | native_divide(float3 left_vector, float3 right_vector); |
| 4307 | #endif |
| 4308 | |
| 4309 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4310 | extern float4 __attribute__((const, overloadable)) |
| 4311 | native_divide(float4 left_vector, float4 right_vector); |
| 4312 | #endif |
| 4313 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4314 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4315 | extern half __attribute__((const, overloadable)) |
| 4316 | native_divide(half left_vector, half right_vector); |
| 4317 | #endif |
| 4318 | |
| 4319 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4320 | extern half2 __attribute__((const, overloadable)) |
| 4321 | native_divide(half2 left_vector, half2 right_vector); |
| 4322 | #endif |
| 4323 | |
| 4324 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4325 | extern half3 __attribute__((const, overloadable)) |
| 4326 | native_divide(half3 left_vector, half3 right_vector); |
| 4327 | #endif |
| 4328 | |
| 4329 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4330 | extern half4 __attribute__((const, overloadable)) |
| 4331 | native_divide(half4 left_vector, half4 right_vector); |
| 4332 | #endif |
| 4333 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4334 | /* |
| 4335 | * native_exp: Approximate e raised to a number |
| 4336 | * |
| 4337 | * Fast approximate exp. |
| 4338 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 4339 | * It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be |
| 4340 | * expected from using 16 bit floating point values. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4341 | * |
| 4342 | * See also exp(). |
| 4343 | */ |
| 4344 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4345 | extern float __attribute__((const, overloadable)) |
| 4346 | native_exp(float v); |
| 4347 | #endif |
| 4348 | |
| 4349 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4350 | extern float2 __attribute__((const, overloadable)) |
| 4351 | native_exp(float2 v); |
| 4352 | #endif |
| 4353 | |
| 4354 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4355 | extern float3 __attribute__((const, overloadable)) |
| 4356 | native_exp(float3 v); |
| 4357 | #endif |
| 4358 | |
| 4359 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4360 | extern float4 __attribute__((const, overloadable)) |
| 4361 | native_exp(float4 v); |
| 4362 | #endif |
| 4363 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4364 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4365 | extern half __attribute__((const, overloadable)) |
| 4366 | native_exp(half v); |
| 4367 | #endif |
| 4368 | |
| 4369 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4370 | extern half2 __attribute__((const, overloadable)) |
| 4371 | native_exp(half2 v); |
| 4372 | #endif |
| 4373 | |
| 4374 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4375 | extern half3 __attribute__((const, overloadable)) |
| 4376 | native_exp(half3 v); |
| 4377 | #endif |
| 4378 | |
| 4379 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4380 | extern half4 __attribute__((const, overloadable)) |
| 4381 | native_exp(half4 v); |
| 4382 | #endif |
| 4383 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4384 | /* |
| 4385 | * native_exp10: Approximate 10 raised to a number |
| 4386 | * |
| 4387 | * Fast approximate exp10. |
| 4388 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 4389 | * It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be |
| 4390 | * expected from using 16 bit floating point values. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4391 | * |
| 4392 | * See also exp10(). |
| 4393 | */ |
| 4394 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4395 | extern float __attribute__((const, overloadable)) |
| 4396 | native_exp10(float v); |
| 4397 | #endif |
| 4398 | |
| 4399 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4400 | extern float2 __attribute__((const, overloadable)) |
| 4401 | native_exp10(float2 v); |
| 4402 | #endif |
| 4403 | |
| 4404 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4405 | extern float3 __attribute__((const, overloadable)) |
| 4406 | native_exp10(float3 v); |
| 4407 | #endif |
| 4408 | |
| 4409 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4410 | extern float4 __attribute__((const, overloadable)) |
| 4411 | native_exp10(float4 v); |
| 4412 | #endif |
| 4413 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4414 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4415 | extern half __attribute__((const, overloadable)) |
| 4416 | native_exp10(half v); |
| 4417 | #endif |
| 4418 | |
| 4419 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4420 | extern half2 __attribute__((const, overloadable)) |
| 4421 | native_exp10(half2 v); |
| 4422 | #endif |
| 4423 | |
| 4424 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4425 | extern half3 __attribute__((const, overloadable)) |
| 4426 | native_exp10(half3 v); |
| 4427 | #endif |
| 4428 | |
| 4429 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4430 | extern half4 __attribute__((const, overloadable)) |
| 4431 | native_exp10(half4 v); |
| 4432 | #endif |
| 4433 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4434 | /* |
| 4435 | * native_exp2: Approximate 2 raised to a number |
| 4436 | * |
| 4437 | * Fast approximate exp2. |
| 4438 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 4439 | * It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be |
| 4440 | * expected from using 16 bit floating point values. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4441 | * |
| 4442 | * See also exp2(). |
| 4443 | */ |
| 4444 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4445 | extern float __attribute__((const, overloadable)) |
| 4446 | native_exp2(float v); |
| 4447 | #endif |
| 4448 | |
| 4449 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4450 | extern float2 __attribute__((const, overloadable)) |
| 4451 | native_exp2(float2 v); |
| 4452 | #endif |
| 4453 | |
| 4454 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4455 | extern float3 __attribute__((const, overloadable)) |
| 4456 | native_exp2(float3 v); |
| 4457 | #endif |
| 4458 | |
| 4459 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4460 | extern float4 __attribute__((const, overloadable)) |
| 4461 | native_exp2(float4 v); |
| 4462 | #endif |
| 4463 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4464 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4465 | extern half __attribute__((const, overloadable)) |
| 4466 | native_exp2(half v); |
| 4467 | #endif |
| 4468 | |
| 4469 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4470 | extern half2 __attribute__((const, overloadable)) |
| 4471 | native_exp2(half2 v); |
| 4472 | #endif |
| 4473 | |
| 4474 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4475 | extern half3 __attribute__((const, overloadable)) |
| 4476 | native_exp2(half3 v); |
| 4477 | #endif |
| 4478 | |
| 4479 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4480 | extern half4 __attribute__((const, overloadable)) |
| 4481 | native_exp2(half4 v); |
| 4482 | #endif |
| 4483 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4484 | /* |
| 4485 | * native_expm1: Approximate e raised to a number minus one |
| 4486 | * |
| 4487 | * Returns the approximate (e ^ v) - 1. |
| 4488 | * |
| 4489 | * See also expm1(). |
| 4490 | */ |
| 4491 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4492 | extern float __attribute__((const, overloadable)) |
| 4493 | native_expm1(float v); |
| 4494 | #endif |
| 4495 | |
| 4496 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4497 | extern float2 __attribute__((const, overloadable)) |
| 4498 | native_expm1(float2 v); |
| 4499 | #endif |
| 4500 | |
| 4501 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4502 | extern float3 __attribute__((const, overloadable)) |
| 4503 | native_expm1(float3 v); |
| 4504 | #endif |
| 4505 | |
| 4506 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4507 | extern float4 __attribute__((const, overloadable)) |
| 4508 | native_expm1(float4 v); |
| 4509 | #endif |
| 4510 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4511 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4512 | extern half __attribute__((const, overloadable)) |
| 4513 | native_expm1(half v); |
| 4514 | #endif |
| 4515 | |
| 4516 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4517 | extern half2 __attribute__((const, overloadable)) |
| 4518 | native_expm1(half2 v); |
| 4519 | #endif |
| 4520 | |
| 4521 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4522 | extern half3 __attribute__((const, overloadable)) |
| 4523 | native_expm1(half3 v); |
| 4524 | #endif |
| 4525 | |
| 4526 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4527 | extern half4 __attribute__((const, overloadable)) |
| 4528 | native_expm1(half4 v); |
| 4529 | #endif |
| 4530 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4531 | /* |
| 4532 | * native_hypot: Approximate hypotenuse |
| 4533 | * |
| 4534 | * Returns the approximate native_sqrt(a * a + b * b) |
| 4535 | * |
| 4536 | * See also hypot(). |
| 4537 | */ |
| 4538 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4539 | extern float __attribute__((const, overloadable)) |
| 4540 | native_hypot(float a, float b); |
| 4541 | #endif |
| 4542 | |
| 4543 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4544 | extern float2 __attribute__((const, overloadable)) |
| 4545 | native_hypot(float2 a, float2 b); |
| 4546 | #endif |
| 4547 | |
| 4548 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4549 | extern float3 __attribute__((const, overloadable)) |
| 4550 | native_hypot(float3 a, float3 b); |
| 4551 | #endif |
| 4552 | |
| 4553 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4554 | extern float4 __attribute__((const, overloadable)) |
| 4555 | native_hypot(float4 a, float4 b); |
| 4556 | #endif |
| 4557 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4558 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4559 | extern half __attribute__((const, overloadable)) |
| 4560 | native_hypot(half a, half b); |
| 4561 | #endif |
| 4562 | |
| 4563 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4564 | extern half2 __attribute__((const, overloadable)) |
| 4565 | native_hypot(half2 a, half2 b); |
| 4566 | #endif |
| 4567 | |
| 4568 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4569 | extern half3 __attribute__((const, overloadable)) |
| 4570 | native_hypot(half3 a, half3 b); |
| 4571 | #endif |
| 4572 | |
| 4573 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4574 | extern half4 __attribute__((const, overloadable)) |
| 4575 | native_hypot(half4 a, half4 b); |
| 4576 | #endif |
| 4577 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4578 | /* |
| 4579 | * native_log: Approximate natural logarithm |
| 4580 | * |
| 4581 | * Fast approximate log. |
| 4582 | * |
| 4583 | * It is not accurate for values very close to zero. |
| 4584 | * |
| 4585 | * See also log(). |
| 4586 | */ |
| 4587 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4588 | extern float __attribute__((const, overloadable)) |
| 4589 | native_log(float v); |
| 4590 | #endif |
| 4591 | |
| 4592 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4593 | extern float2 __attribute__((const, overloadable)) |
| 4594 | native_log(float2 v); |
| 4595 | #endif |
| 4596 | |
| 4597 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4598 | extern float3 __attribute__((const, overloadable)) |
| 4599 | native_log(float3 v); |
| 4600 | #endif |
| 4601 | |
| 4602 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4603 | extern float4 __attribute__((const, overloadable)) |
| 4604 | native_log(float4 v); |
| 4605 | #endif |
| 4606 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4607 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4608 | extern half __attribute__((const, overloadable)) |
| 4609 | native_log(half v); |
| 4610 | #endif |
| 4611 | |
| 4612 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4613 | extern half2 __attribute__((const, overloadable)) |
| 4614 | native_log(half2 v); |
| 4615 | #endif |
| 4616 | |
| 4617 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4618 | extern half3 __attribute__((const, overloadable)) |
| 4619 | native_log(half3 v); |
| 4620 | #endif |
| 4621 | |
| 4622 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4623 | extern half4 __attribute__((const, overloadable)) |
| 4624 | native_log(half4 v); |
| 4625 | #endif |
| 4626 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4627 | /* |
| 4628 | * native_log10: Approximate base 10 logarithm |
| 4629 | * |
| 4630 | * Fast approximate log10. |
| 4631 | * |
| 4632 | * It is not accurate for values very close to zero. |
| 4633 | * |
| 4634 | * See also log10(). |
| 4635 | */ |
| 4636 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4637 | extern float __attribute__((const, overloadable)) |
| 4638 | native_log10(float v); |
| 4639 | #endif |
| 4640 | |
| 4641 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4642 | extern float2 __attribute__((const, overloadable)) |
| 4643 | native_log10(float2 v); |
| 4644 | #endif |
| 4645 | |
| 4646 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4647 | extern float3 __attribute__((const, overloadable)) |
| 4648 | native_log10(float3 v); |
| 4649 | #endif |
| 4650 | |
| 4651 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4652 | extern float4 __attribute__((const, overloadable)) |
| 4653 | native_log10(float4 v); |
| 4654 | #endif |
| 4655 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4656 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4657 | extern half __attribute__((const, overloadable)) |
| 4658 | native_log10(half v); |
| 4659 | #endif |
| 4660 | |
| 4661 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4662 | extern half2 __attribute__((const, overloadable)) |
| 4663 | native_log10(half2 v); |
| 4664 | #endif |
| 4665 | |
| 4666 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4667 | extern half3 __attribute__((const, overloadable)) |
| 4668 | native_log10(half3 v); |
| 4669 | #endif |
| 4670 | |
| 4671 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4672 | extern half4 __attribute__((const, overloadable)) |
| 4673 | native_log10(half4 v); |
| 4674 | #endif |
| 4675 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4676 | /* |
| 4677 | * native_log1p: Approximate natural logarithm of a value plus 1 |
| 4678 | * |
| 4679 | * Returns the approximate natural logarithm of (v + 1.0f) |
| 4680 | * |
| 4681 | * See also log1p(). |
| 4682 | */ |
| 4683 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4684 | extern float __attribute__((const, overloadable)) |
| 4685 | native_log1p(float v); |
| 4686 | #endif |
| 4687 | |
| 4688 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4689 | extern float2 __attribute__((const, overloadable)) |
| 4690 | native_log1p(float2 v); |
| 4691 | #endif |
| 4692 | |
| 4693 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4694 | extern float3 __attribute__((const, overloadable)) |
| 4695 | native_log1p(float3 v); |
| 4696 | #endif |
| 4697 | |
| 4698 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4699 | extern float4 __attribute__((const, overloadable)) |
| 4700 | native_log1p(float4 v); |
| 4701 | #endif |
| 4702 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4703 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4704 | extern half __attribute__((const, overloadable)) |
| 4705 | native_log1p(half v); |
| 4706 | #endif |
| 4707 | |
| 4708 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4709 | extern half2 __attribute__((const, overloadable)) |
| 4710 | native_log1p(half2 v); |
| 4711 | #endif |
| 4712 | |
| 4713 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4714 | extern half3 __attribute__((const, overloadable)) |
| 4715 | native_log1p(half3 v); |
| 4716 | #endif |
| 4717 | |
| 4718 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4719 | extern half4 __attribute__((const, overloadable)) |
| 4720 | native_log1p(half4 v); |
| 4721 | #endif |
| 4722 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4723 | /* |
| 4724 | * native_log2: Approximate base 2 logarithm |
| 4725 | * |
| 4726 | * Fast approximate log2. |
| 4727 | * |
| 4728 | * It is not accurate for values very close to zero. |
| 4729 | * |
| 4730 | * See also log2(). |
| 4731 | */ |
| 4732 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4733 | extern float __attribute__((const, overloadable)) |
| 4734 | native_log2(float v); |
| 4735 | #endif |
| 4736 | |
| 4737 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4738 | extern float2 __attribute__((const, overloadable)) |
| 4739 | native_log2(float2 v); |
| 4740 | #endif |
| 4741 | |
| 4742 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4743 | extern float3 __attribute__((const, overloadable)) |
| 4744 | native_log2(float3 v); |
| 4745 | #endif |
| 4746 | |
| 4747 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4748 | extern float4 __attribute__((const, overloadable)) |
| 4749 | native_log2(float4 v); |
| 4750 | #endif |
| 4751 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4752 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4753 | extern half __attribute__((const, overloadable)) |
| 4754 | native_log2(half v); |
| 4755 | #endif |
| 4756 | |
| 4757 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4758 | extern half2 __attribute__((const, overloadable)) |
| 4759 | native_log2(half2 v); |
| 4760 | #endif |
| 4761 | |
| 4762 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4763 | extern half3 __attribute__((const, overloadable)) |
| 4764 | native_log2(half3 v); |
| 4765 | #endif |
| 4766 | |
| 4767 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4768 | extern half4 __attribute__((const, overloadable)) |
| 4769 | native_log2(half4 v); |
| 4770 | #endif |
| 4771 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4772 | /* |
| 4773 | * native_powr: Approximate positive base raised to an exponent |
| 4774 | * |
| 4775 | * Fast approximate (base ^ exponent). |
| 4776 | * |
| 4777 | * See also powr(). |
| 4778 | * |
| 4779 | * Parameters: |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 4780 | * base: Must be between 0.f and 256.f. The function is not accurate for values very close to zero. |
| 4781 | * exponent: Must be between -15.f and 15.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4782 | */ |
| 4783 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4784 | extern float __attribute__((const, overloadable)) |
| 4785 | native_powr(float base, float exponent); |
| 4786 | #endif |
| 4787 | |
| 4788 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4789 | extern float2 __attribute__((const, overloadable)) |
| 4790 | native_powr(float2 base, float2 exponent); |
| 4791 | #endif |
| 4792 | |
| 4793 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4794 | extern float3 __attribute__((const, overloadable)) |
| 4795 | native_powr(float3 base, float3 exponent); |
| 4796 | #endif |
| 4797 | |
| 4798 | #if (defined(RS_VERSION) && (RS_VERSION >= 18)) |
| 4799 | extern float4 __attribute__((const, overloadable)) |
| 4800 | native_powr(float4 base, float4 exponent); |
| 4801 | #endif |
| 4802 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4803 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4804 | extern half __attribute__((const, overloadable)) |
| 4805 | native_powr(half base, half exponent); |
| 4806 | #endif |
| 4807 | |
| 4808 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4809 | extern half2 __attribute__((const, overloadable)) |
| 4810 | native_powr(half2 base, half2 exponent); |
| 4811 | #endif |
| 4812 | |
| 4813 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4814 | extern half3 __attribute__((const, overloadable)) |
| 4815 | native_powr(half3 base, half3 exponent); |
| 4816 | #endif |
| 4817 | |
| 4818 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4819 | extern half4 __attribute__((const, overloadable)) |
| 4820 | native_powr(half4 base, half4 exponent); |
| 4821 | #endif |
| 4822 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4823 | /* |
| 4824 | * native_recip: Approximate reciprocal |
| 4825 | * |
| 4826 | * Returns the approximate approximate reciprocal of a value. |
| 4827 | * |
| 4828 | * See also half_recip(). |
| 4829 | */ |
| 4830 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4831 | extern float __attribute__((const, overloadable)) |
| 4832 | native_recip(float v); |
| 4833 | #endif |
| 4834 | |
| 4835 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4836 | extern float2 __attribute__((const, overloadable)) |
| 4837 | native_recip(float2 v); |
| 4838 | #endif |
| 4839 | |
| 4840 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4841 | extern float3 __attribute__((const, overloadable)) |
| 4842 | native_recip(float3 v); |
| 4843 | #endif |
| 4844 | |
| 4845 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4846 | extern float4 __attribute__((const, overloadable)) |
| 4847 | native_recip(float4 v); |
| 4848 | #endif |
| 4849 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4850 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4851 | extern half __attribute__((const, overloadable)) |
| 4852 | native_recip(half v); |
| 4853 | #endif |
| 4854 | |
| 4855 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4856 | extern half2 __attribute__((const, overloadable)) |
| 4857 | native_recip(half2 v); |
| 4858 | #endif |
| 4859 | |
| 4860 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4861 | extern half3 __attribute__((const, overloadable)) |
| 4862 | native_recip(half3 v); |
| 4863 | #endif |
| 4864 | |
| 4865 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4866 | extern half4 __attribute__((const, overloadable)) |
| 4867 | native_recip(half4 v); |
| 4868 | #endif |
| 4869 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4870 | /* |
| 4871 | * native_rootn: Approximate nth root |
| 4872 | * |
| 4873 | * Compute the approximate Nth root of a value. |
| 4874 | * |
| 4875 | * See also rootn(). |
| 4876 | */ |
| 4877 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4878 | extern float __attribute__((const, overloadable)) |
| 4879 | native_rootn(float v, int n); |
| 4880 | #endif |
| 4881 | |
| 4882 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4883 | extern float2 __attribute__((const, overloadable)) |
| 4884 | native_rootn(float2 v, int2 n); |
| 4885 | #endif |
| 4886 | |
| 4887 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4888 | extern float3 __attribute__((const, overloadable)) |
| 4889 | native_rootn(float3 v, int3 n); |
| 4890 | #endif |
| 4891 | |
| 4892 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4893 | extern float4 __attribute__((const, overloadable)) |
| 4894 | native_rootn(float4 v, int4 n); |
| 4895 | #endif |
| 4896 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4897 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4898 | extern half __attribute__((const, overloadable)) |
| 4899 | native_rootn(half v, int n); |
| 4900 | #endif |
| 4901 | |
| 4902 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4903 | extern half2 __attribute__((const, overloadable)) |
| 4904 | native_rootn(half2 v, int2 n); |
| 4905 | #endif |
| 4906 | |
| 4907 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4908 | extern half3 __attribute__((const, overloadable)) |
| 4909 | native_rootn(half3 v, int3 n); |
| 4910 | #endif |
| 4911 | |
| 4912 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4913 | extern half4 __attribute__((const, overloadable)) |
| 4914 | native_rootn(half4 v, int4 n); |
| 4915 | #endif |
| 4916 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4917 | /* |
| 4918 | * native_rsqrt: Approximate reciprocal of a square root |
| 4919 | * |
| 4920 | * Returns approximate (1 / sqrt(v)). |
| 4921 | * |
| 4922 | * See also rsqrt(), half_rsqrt(). |
| 4923 | */ |
| 4924 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4925 | extern float __attribute__((const, overloadable)) |
| 4926 | native_rsqrt(float v); |
| 4927 | #endif |
| 4928 | |
| 4929 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4930 | extern float2 __attribute__((const, overloadable)) |
| 4931 | native_rsqrt(float2 v); |
| 4932 | #endif |
| 4933 | |
| 4934 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4935 | extern float3 __attribute__((const, overloadable)) |
| 4936 | native_rsqrt(float3 v); |
| 4937 | #endif |
| 4938 | |
| 4939 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4940 | extern float4 __attribute__((const, overloadable)) |
| 4941 | native_rsqrt(float4 v); |
| 4942 | #endif |
| 4943 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4944 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4945 | extern half __attribute__((const, overloadable)) |
| 4946 | native_rsqrt(half v); |
| 4947 | #endif |
| 4948 | |
| 4949 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4950 | extern half2 __attribute__((const, overloadable)) |
| 4951 | native_rsqrt(half2 v); |
| 4952 | #endif |
| 4953 | |
| 4954 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4955 | extern half3 __attribute__((const, overloadable)) |
| 4956 | native_rsqrt(half3 v); |
| 4957 | #endif |
| 4958 | |
| 4959 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4960 | extern half4 __attribute__((const, overloadable)) |
| 4961 | native_rsqrt(half4 v); |
| 4962 | #endif |
| 4963 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 4964 | /* |
| 4965 | * native_sin: Approximate sine |
| 4966 | * |
| 4967 | * Returns the approximate sine of an angle measured in radians. |
| 4968 | * |
| 4969 | * See also sin(). |
| 4970 | */ |
| 4971 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4972 | extern float __attribute__((const, overloadable)) |
| 4973 | native_sin(float v); |
| 4974 | #endif |
| 4975 | |
| 4976 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4977 | extern float2 __attribute__((const, overloadable)) |
| 4978 | native_sin(float2 v); |
| 4979 | #endif |
| 4980 | |
| 4981 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4982 | extern float3 __attribute__((const, overloadable)) |
| 4983 | native_sin(float3 v); |
| 4984 | #endif |
| 4985 | |
| 4986 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 4987 | extern float4 __attribute__((const, overloadable)) |
| 4988 | native_sin(float4 v); |
| 4989 | #endif |
| 4990 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 4991 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4992 | extern half __attribute__((const, overloadable)) |
| 4993 | native_sin(half v); |
| 4994 | #endif |
| 4995 | |
| 4996 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 4997 | extern half2 __attribute__((const, overloadable)) |
| 4998 | native_sin(half2 v); |
| 4999 | #endif |
| 5000 | |
| 5001 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5002 | extern half3 __attribute__((const, overloadable)) |
| 5003 | native_sin(half3 v); |
| 5004 | #endif |
| 5005 | |
| 5006 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5007 | extern half4 __attribute__((const, overloadable)) |
| 5008 | native_sin(half4 v); |
| 5009 | #endif |
| 5010 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5011 | /* |
| 5012 | * native_sincos: Approximate sine and cosine |
| 5013 | * |
| 5014 | * Returns the approximate sine and cosine of a value. |
| 5015 | * |
| 5016 | * See also sincos(). |
| 5017 | * |
| 5018 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5019 | * v: Incoming value in radians. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 5020 | * cos: *cos will be set to the cosine value. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5021 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5022 | * Returns: Sine. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5023 | */ |
| 5024 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5025 | extern float __attribute__((overloadable)) |
| 5026 | native_sincos(float v, float* cos); |
| 5027 | #endif |
| 5028 | |
| 5029 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5030 | extern float2 __attribute__((overloadable)) |
| 5031 | native_sincos(float2 v, float2* cos); |
| 5032 | #endif |
| 5033 | |
| 5034 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5035 | extern float3 __attribute__((overloadable)) |
| 5036 | native_sincos(float3 v, float3* cos); |
| 5037 | #endif |
| 5038 | |
| 5039 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5040 | extern float4 __attribute__((overloadable)) |
| 5041 | native_sincos(float4 v, float4* cos); |
| 5042 | #endif |
| 5043 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5044 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5045 | extern half __attribute__((overloadable)) |
| 5046 | native_sincos(half v, half* cos); |
| 5047 | #endif |
| 5048 | |
| 5049 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5050 | extern half2 __attribute__((overloadable)) |
| 5051 | native_sincos(half2 v, half2* cos); |
| 5052 | #endif |
| 5053 | |
| 5054 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5055 | extern half3 __attribute__((overloadable)) |
| 5056 | native_sincos(half3 v, half3* cos); |
| 5057 | #endif |
| 5058 | |
| 5059 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5060 | extern half4 __attribute__((overloadable)) |
| 5061 | native_sincos(half4 v, half4* cos); |
| 5062 | #endif |
| 5063 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5064 | /* |
| 5065 | * native_sinh: Approximate hyperbolic sine |
| 5066 | * |
| 5067 | * Returns the approximate hyperbolic sine of a value specified in radians. |
| 5068 | * |
| 5069 | * See also sinh(). |
| 5070 | */ |
| 5071 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5072 | extern float __attribute__((const, overloadable)) |
| 5073 | native_sinh(float v); |
| 5074 | #endif |
| 5075 | |
| 5076 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5077 | extern float2 __attribute__((const, overloadable)) |
| 5078 | native_sinh(float2 v); |
| 5079 | #endif |
| 5080 | |
| 5081 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5082 | extern float3 __attribute__((const, overloadable)) |
| 5083 | native_sinh(float3 v); |
| 5084 | #endif |
| 5085 | |
| 5086 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5087 | extern float4 __attribute__((const, overloadable)) |
| 5088 | native_sinh(float4 v); |
| 5089 | #endif |
| 5090 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5091 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5092 | extern half __attribute__((const, overloadable)) |
| 5093 | native_sinh(half v); |
| 5094 | #endif |
| 5095 | |
| 5096 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5097 | extern half2 __attribute__((const, overloadable)) |
| 5098 | native_sinh(half2 v); |
| 5099 | #endif |
| 5100 | |
| 5101 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5102 | extern half3 __attribute__((const, overloadable)) |
| 5103 | native_sinh(half3 v); |
| 5104 | #endif |
| 5105 | |
| 5106 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5107 | extern half4 __attribute__((const, overloadable)) |
| 5108 | native_sinh(half4 v); |
| 5109 | #endif |
| 5110 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5111 | /* |
| 5112 | * native_sinpi: Approximate sine of a number multiplied by pi |
| 5113 | * |
| 5114 | * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians. |
| 5115 | * |
| 5116 | * To get the sine of a value measured in degrees, call sinpi(v / 180.f). |
| 5117 | * |
| 5118 | * See also sinpi(). |
| 5119 | */ |
| 5120 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5121 | extern float __attribute__((const, overloadable)) |
| 5122 | native_sinpi(float v); |
| 5123 | #endif |
| 5124 | |
| 5125 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5126 | extern float2 __attribute__((const, overloadable)) |
| 5127 | native_sinpi(float2 v); |
| 5128 | #endif |
| 5129 | |
| 5130 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5131 | extern float3 __attribute__((const, overloadable)) |
| 5132 | native_sinpi(float3 v); |
| 5133 | #endif |
| 5134 | |
| 5135 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5136 | extern float4 __attribute__((const, overloadable)) |
| 5137 | native_sinpi(float4 v); |
| 5138 | #endif |
| 5139 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5140 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5141 | extern half __attribute__((const, overloadable)) |
| 5142 | native_sinpi(half v); |
| 5143 | #endif |
| 5144 | |
| 5145 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5146 | extern half2 __attribute__((const, overloadable)) |
| 5147 | native_sinpi(half2 v); |
| 5148 | #endif |
| 5149 | |
| 5150 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5151 | extern half3 __attribute__((const, overloadable)) |
| 5152 | native_sinpi(half3 v); |
| 5153 | #endif |
| 5154 | |
| 5155 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5156 | extern half4 __attribute__((const, overloadable)) |
| 5157 | native_sinpi(half4 v); |
| 5158 | #endif |
| 5159 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5160 | /* |
| 5161 | * native_sqrt: Approximate square root |
| 5162 | * |
| 5163 | * Returns the approximate sqrt(v). |
| 5164 | * |
| 5165 | * See also sqrt(), half_sqrt(). |
| 5166 | */ |
| 5167 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5168 | extern float __attribute__((const, overloadable)) |
| 5169 | native_sqrt(float v); |
| 5170 | #endif |
| 5171 | |
| 5172 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5173 | extern float2 __attribute__((const, overloadable)) |
| 5174 | native_sqrt(float2 v); |
| 5175 | #endif |
| 5176 | |
| 5177 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5178 | extern float3 __attribute__((const, overloadable)) |
| 5179 | native_sqrt(float3 v); |
| 5180 | #endif |
| 5181 | |
| 5182 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5183 | extern float4 __attribute__((const, overloadable)) |
| 5184 | native_sqrt(float4 v); |
| 5185 | #endif |
| 5186 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5187 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5188 | extern half __attribute__((const, overloadable)) |
| 5189 | native_sqrt(half v); |
| 5190 | #endif |
| 5191 | |
| 5192 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5193 | extern half2 __attribute__((const, overloadable)) |
| 5194 | native_sqrt(half2 v); |
| 5195 | #endif |
| 5196 | |
| 5197 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5198 | extern half3 __attribute__((const, overloadable)) |
| 5199 | native_sqrt(half3 v); |
| 5200 | #endif |
| 5201 | |
| 5202 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5203 | extern half4 __attribute__((const, overloadable)) |
| 5204 | native_sqrt(half4 v); |
| 5205 | #endif |
| 5206 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5207 | /* |
| 5208 | * native_tan: Approximate tangent |
| 5209 | * |
| 5210 | * Returns the approximate tangent of an angle measured in radians. |
| 5211 | */ |
| 5212 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5213 | extern float __attribute__((const, overloadable)) |
| 5214 | native_tan(float v); |
| 5215 | #endif |
| 5216 | |
| 5217 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5218 | extern float2 __attribute__((const, overloadable)) |
| 5219 | native_tan(float2 v); |
| 5220 | #endif |
| 5221 | |
| 5222 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5223 | extern float3 __attribute__((const, overloadable)) |
| 5224 | native_tan(float3 v); |
| 5225 | #endif |
| 5226 | |
| 5227 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5228 | extern float4 __attribute__((const, overloadable)) |
| 5229 | native_tan(float4 v); |
| 5230 | #endif |
| 5231 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5232 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5233 | extern half __attribute__((const, overloadable)) |
| 5234 | native_tan(half v); |
| 5235 | #endif |
| 5236 | |
| 5237 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5238 | extern half2 __attribute__((const, overloadable)) |
| 5239 | native_tan(half2 v); |
| 5240 | #endif |
| 5241 | |
| 5242 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5243 | extern half3 __attribute__((const, overloadable)) |
| 5244 | native_tan(half3 v); |
| 5245 | #endif |
| 5246 | |
| 5247 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5248 | extern half4 __attribute__((const, overloadable)) |
| 5249 | native_tan(half4 v); |
| 5250 | #endif |
| 5251 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5252 | /* |
| 5253 | * native_tanh: Approximate hyperbolic tangent |
| 5254 | * |
| 5255 | * Returns the approximate hyperbolic tangent of a value. |
| 5256 | * |
| 5257 | * See also tanh(). |
| 5258 | */ |
| 5259 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5260 | extern float __attribute__((const, overloadable)) |
| 5261 | native_tanh(float v); |
| 5262 | #endif |
| 5263 | |
| 5264 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5265 | extern float2 __attribute__((const, overloadable)) |
| 5266 | native_tanh(float2 v); |
| 5267 | #endif |
| 5268 | |
| 5269 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5270 | extern float3 __attribute__((const, overloadable)) |
| 5271 | native_tanh(float3 v); |
| 5272 | #endif |
| 5273 | |
| 5274 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5275 | extern float4 __attribute__((const, overloadable)) |
| 5276 | native_tanh(float4 v); |
| 5277 | #endif |
| 5278 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5279 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5280 | extern half __attribute__((const, overloadable)) |
| 5281 | native_tanh(half v); |
| 5282 | #endif |
| 5283 | |
| 5284 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5285 | extern half2 __attribute__((const, overloadable)) |
| 5286 | native_tanh(half2 v); |
| 5287 | #endif |
| 5288 | |
| 5289 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5290 | extern half3 __attribute__((const, overloadable)) |
| 5291 | native_tanh(half3 v); |
| 5292 | #endif |
| 5293 | |
| 5294 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5295 | extern half4 __attribute__((const, overloadable)) |
| 5296 | native_tanh(half4 v); |
| 5297 | #endif |
| 5298 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5299 | /* |
| 5300 | * native_tanpi: Approximate tangent of a number multiplied by pi |
| 5301 | * |
| 5302 | * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians. |
| 5303 | * |
| 5304 | * To get the tangent of a value measured in degrees, call tanpi(v / 180.f). |
| 5305 | * |
| 5306 | * See also tanpi(). |
| 5307 | */ |
| 5308 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5309 | extern float __attribute__((const, overloadable)) |
| 5310 | native_tanpi(float v); |
| 5311 | #endif |
| 5312 | |
| 5313 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5314 | extern float2 __attribute__((const, overloadable)) |
| 5315 | native_tanpi(float2 v); |
| 5316 | #endif |
| 5317 | |
| 5318 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5319 | extern float3 __attribute__((const, overloadable)) |
| 5320 | native_tanpi(float3 v); |
| 5321 | #endif |
| 5322 | |
| 5323 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 5324 | extern float4 __attribute__((const, overloadable)) |
| 5325 | native_tanpi(float4 v); |
| 5326 | #endif |
| 5327 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5328 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5329 | extern half __attribute__((const, overloadable)) |
| 5330 | native_tanpi(half v); |
| 5331 | #endif |
| 5332 | |
| 5333 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5334 | extern half2 __attribute__((const, overloadable)) |
| 5335 | native_tanpi(half2 v); |
| 5336 | #endif |
| 5337 | |
| 5338 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5339 | extern half3 __attribute__((const, overloadable)) |
| 5340 | native_tanpi(half3 v); |
| 5341 | #endif |
| 5342 | |
| 5343 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5344 | extern half4 __attribute__((const, overloadable)) |
| 5345 | native_tanpi(half4 v); |
| 5346 | #endif |
| 5347 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5348 | /* |
| 5349 | * nextafter: Next floating point number |
| 5350 | * |
| 5351 | * Returns the next representable floating point number from v towards target. |
| 5352 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5353 | * In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized |
| 5354 | * value, as support of denormalized values is optional in relaxed mode. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5355 | */ |
| 5356 | extern float __attribute__((const, overloadable)) |
| 5357 | nextafter(float v, float target); |
| 5358 | |
| 5359 | extern float2 __attribute__((const, overloadable)) |
| 5360 | nextafter(float2 v, float2 target); |
| 5361 | |
| 5362 | extern float3 __attribute__((const, overloadable)) |
| 5363 | nextafter(float3 v, float3 target); |
| 5364 | |
| 5365 | extern float4 __attribute__((const, overloadable)) |
| 5366 | nextafter(float4 v, float4 target); |
| 5367 | |
| 5368 | /* |
| 5369 | * pow: Base raised to an exponent |
| 5370 | * |
| 5371 | * Returns base raised to the power exponent, i.e. base ^ exponent. |
| 5372 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5373 | * pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the |
| 5374 | * base to be non-negative. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5375 | */ |
| 5376 | extern float __attribute__((const, overloadable)) |
| 5377 | pow(float base, float exponent); |
| 5378 | |
| 5379 | extern float2 __attribute__((const, overloadable)) |
| 5380 | pow(float2 base, float2 exponent); |
| 5381 | |
| 5382 | extern float3 __attribute__((const, overloadable)) |
| 5383 | pow(float3 base, float3 exponent); |
| 5384 | |
| 5385 | extern float4 __attribute__((const, overloadable)) |
| 5386 | pow(float4 base, float4 exponent); |
| 5387 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5388 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5389 | extern half __attribute__((const, overloadable)) |
| 5390 | pow(half base, half exponent); |
| 5391 | #endif |
| 5392 | |
| 5393 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5394 | extern half2 __attribute__((const, overloadable)) |
| 5395 | pow(half2 base, half2 exponent); |
| 5396 | #endif |
| 5397 | |
| 5398 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5399 | extern half3 __attribute__((const, overloadable)) |
| 5400 | pow(half3 base, half3 exponent); |
| 5401 | #endif |
| 5402 | |
| 5403 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5404 | extern half4 __attribute__((const, overloadable)) |
| 5405 | pow(half4 base, half4 exponent); |
| 5406 | #endif |
| 5407 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5408 | /* |
| 5409 | * pown: Base raised to an integer exponent |
| 5410 | * |
| 5411 | * Returns base raised to the power exponent, i.e. base ^ exponent. |
| 5412 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5413 | * pow() and powr() are similar. The both take a float exponent. powr() also assumes the |
| 5414 | * base to be non-negative. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5415 | */ |
| 5416 | extern float __attribute__((const, overloadable)) |
| 5417 | pown(float base, int exponent); |
| 5418 | |
| 5419 | extern float2 __attribute__((const, overloadable)) |
| 5420 | pown(float2 base, int2 exponent); |
| 5421 | |
| 5422 | extern float3 __attribute__((const, overloadable)) |
| 5423 | pown(float3 base, int3 exponent); |
| 5424 | |
| 5425 | extern float4 __attribute__((const, overloadable)) |
| 5426 | pown(float4 base, int4 exponent); |
| 5427 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5428 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5429 | extern half __attribute__((const, overloadable)) |
| 5430 | pown(half base, int exponent); |
| 5431 | #endif |
| 5432 | |
| 5433 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5434 | extern half2 __attribute__((const, overloadable)) |
| 5435 | pown(half2 base, int2 exponent); |
| 5436 | #endif |
| 5437 | |
| 5438 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5439 | extern half3 __attribute__((const, overloadable)) |
| 5440 | pown(half3 base, int3 exponent); |
| 5441 | #endif |
| 5442 | |
| 5443 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5444 | extern half4 __attribute__((const, overloadable)) |
| 5445 | pown(half4 base, int4 exponent); |
| 5446 | #endif |
| 5447 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5448 | /* |
| 5449 | * powr: Positive base raised to an exponent |
| 5450 | * |
| 5451 | * Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0. |
| 5452 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5453 | * pow() and pown() are similar. They both make no assumptions about the base. |
| 5454 | * pow() takes a float exponent while pown() take an integer. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5455 | * |
| 5456 | * See also native_powr(). |
| 5457 | */ |
| 5458 | extern float __attribute__((const, overloadable)) |
| 5459 | powr(float base, float exponent); |
| 5460 | |
| 5461 | extern float2 __attribute__((const, overloadable)) |
| 5462 | powr(float2 base, float2 exponent); |
| 5463 | |
| 5464 | extern float3 __attribute__((const, overloadable)) |
| 5465 | powr(float3 base, float3 exponent); |
| 5466 | |
| 5467 | extern float4 __attribute__((const, overloadable)) |
| 5468 | powr(float4 base, float4 exponent); |
| 5469 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5470 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5471 | extern half __attribute__((const, overloadable)) |
| 5472 | powr(half base, half exponent); |
| 5473 | #endif |
| 5474 | |
| 5475 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5476 | extern half2 __attribute__((const, overloadable)) |
| 5477 | powr(half2 base, half2 exponent); |
| 5478 | #endif |
| 5479 | |
| 5480 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5481 | extern half3 __attribute__((const, overloadable)) |
| 5482 | powr(half3 base, half3 exponent); |
| 5483 | #endif |
| 5484 | |
| 5485 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5486 | extern half4 __attribute__((const, overloadable)) |
| 5487 | powr(half4 base, half4 exponent); |
| 5488 | #endif |
| 5489 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5490 | /* |
| 5491 | * radians: Converts degrees into radians |
| 5492 | * |
| 5493 | * Converts from degrees to radians. |
| 5494 | */ |
| 5495 | extern float __attribute__((const, overloadable)) |
| 5496 | radians(float v); |
| 5497 | |
| 5498 | extern float2 __attribute__((const, overloadable)) |
| 5499 | radians(float2 v); |
| 5500 | |
| 5501 | extern float3 __attribute__((const, overloadable)) |
| 5502 | radians(float3 v); |
| 5503 | |
| 5504 | extern float4 __attribute__((const, overloadable)) |
| 5505 | radians(float4 v); |
| 5506 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5507 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5508 | extern half __attribute__((const, overloadable)) |
| 5509 | radians(half v); |
| 5510 | #endif |
| 5511 | |
| 5512 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5513 | extern half2 __attribute__((const, overloadable)) |
| 5514 | radians(half2 v); |
| 5515 | #endif |
| 5516 | |
| 5517 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5518 | extern half3 __attribute__((const, overloadable)) |
| 5519 | radians(half3 v); |
| 5520 | #endif |
| 5521 | |
| 5522 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5523 | extern half4 __attribute__((const, overloadable)) |
| 5524 | radians(half4 v); |
| 5525 | #endif |
| 5526 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5527 | /* |
| 5528 | * remainder: Remainder of a division |
| 5529 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5530 | * Returns the remainder of (numerator / denominator), where the quotient is rounded towards |
| 5531 | * the nearest integer. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5532 | * |
| 5533 | * The function fmod() is similar but rounds toward the closest interger. |
| 5534 | * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f) |
| 5535 | * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f). |
| 5536 | */ |
| 5537 | extern float __attribute__((const, overloadable)) |
| 5538 | remainder(float numerator, float denominator); |
| 5539 | |
| 5540 | extern float2 __attribute__((const, overloadable)) |
| 5541 | remainder(float2 numerator, float2 denominator); |
| 5542 | |
| 5543 | extern float3 __attribute__((const, overloadable)) |
| 5544 | remainder(float3 numerator, float3 denominator); |
| 5545 | |
| 5546 | extern float4 __attribute__((const, overloadable)) |
| 5547 | remainder(float4 numerator, float4 denominator); |
| 5548 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5549 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5550 | extern half __attribute__((const, overloadable)) |
| 5551 | remainder(half numerator, half denominator); |
| 5552 | #endif |
| 5553 | |
| 5554 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5555 | extern half2 __attribute__((const, overloadable)) |
| 5556 | remainder(half2 numerator, half2 denominator); |
| 5557 | #endif |
| 5558 | |
| 5559 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5560 | extern half3 __attribute__((const, overloadable)) |
| 5561 | remainder(half3 numerator, half3 denominator); |
| 5562 | #endif |
| 5563 | |
| 5564 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5565 | extern half4 __attribute__((const, overloadable)) |
| 5566 | remainder(half4 numerator, half4 denominator); |
| 5567 | #endif |
| 5568 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5569 | /* |
| 5570 | * remquo: Remainder and quotient of a division |
| 5571 | * |
| 5572 | * Returns the quotient and the remainder of (numerator / denominator). |
| 5573 | * |
| 5574 | * Only the sign and lowest three bits of the quotient are guaranteed to be accurate. |
| 5575 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5576 | * This function is useful for implementing periodic functions. The low three bits of the |
| 5577 | * quotient gives the quadrant and the remainder the distance within the quadrant. |
| 5578 | * For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) |
| 5579 | * 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] | 5580 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5581 | * Example: remquo(-23.5f, 8.f, ") sets the lowest three bits of quot to 3 |
| 5582 | * and the sign negative. It returns 0.5f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5583 | * |
| 5584 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5585 | * numerator: Numerator. |
| 5586 | * denominator: Denominator. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 5587 | * quotient: *quotient will be set to the integer quotient. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5588 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5589 | * Returns: Remainder, precise only for the low three bits. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5590 | */ |
| 5591 | extern float __attribute__((overloadable)) |
| 5592 | remquo(float numerator, float denominator, int* quotient); |
| 5593 | |
| 5594 | extern float2 __attribute__((overloadable)) |
| 5595 | remquo(float2 numerator, float2 denominator, int2* quotient); |
| 5596 | |
| 5597 | extern float3 __attribute__((overloadable)) |
| 5598 | remquo(float3 numerator, float3 denominator, int3* quotient); |
| 5599 | |
| 5600 | extern float4 __attribute__((overloadable)) |
| 5601 | remquo(float4 numerator, float4 denominator, int4* quotient); |
| 5602 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5603 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5604 | extern half __attribute__((overloadable)) |
| 5605 | remquo(half numerator, half denominator, int* quotient); |
| 5606 | #endif |
| 5607 | |
| 5608 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5609 | extern half2 __attribute__((overloadable)) |
| 5610 | remquo(half2 numerator, half2 denominator, int2* quotient); |
| 5611 | #endif |
| 5612 | |
| 5613 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5614 | extern half3 __attribute__((overloadable)) |
| 5615 | remquo(half3 numerator, half3 denominator, int3* quotient); |
| 5616 | #endif |
| 5617 | |
| 5618 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5619 | extern half4 __attribute__((overloadable)) |
| 5620 | remquo(half4 numerator, half4 denominator, int4* quotient); |
| 5621 | #endif |
| 5622 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5623 | /* |
| 5624 | * rint: Round to even |
| 5625 | * |
| 5626 | * Rounds to the nearest integral value. |
| 5627 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5628 | * rint() rounds half values to even. For example, rint(0.5f) returns 0.f and |
| 5629 | * rint(1.5f) returns 2.f. Similarly, rint(-0.5f) returns -0.f and |
| 5630 | * rint(-1.5f) returns -2.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5631 | * |
| 5632 | * round() is similar but rounds away from zero. trunc() truncates the decimal fraction. |
| 5633 | */ |
| 5634 | extern float __attribute__((const, overloadable)) |
| 5635 | rint(float v); |
| 5636 | |
| 5637 | extern float2 __attribute__((const, overloadable)) |
| 5638 | rint(float2 v); |
| 5639 | |
| 5640 | extern float3 __attribute__((const, overloadable)) |
| 5641 | rint(float3 v); |
| 5642 | |
| 5643 | extern float4 __attribute__((const, overloadable)) |
| 5644 | rint(float4 v); |
| 5645 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5646 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5647 | extern half __attribute__((const, overloadable)) |
| 5648 | rint(half v); |
| 5649 | #endif |
| 5650 | |
| 5651 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5652 | extern half2 __attribute__((const, overloadable)) |
| 5653 | rint(half2 v); |
| 5654 | #endif |
| 5655 | |
| 5656 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5657 | extern half3 __attribute__((const, overloadable)) |
| 5658 | rint(half3 v); |
| 5659 | #endif |
| 5660 | |
| 5661 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5662 | extern half4 __attribute__((const, overloadable)) |
| 5663 | rint(half4 v); |
| 5664 | #endif |
| 5665 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5666 | /* |
| 5667 | * rootn: Nth root |
| 5668 | * |
| 5669 | * Compute the Nth root of a value. |
| 5670 | * |
| 5671 | * See also native_rootn(). |
| 5672 | */ |
| 5673 | extern float __attribute__((const, overloadable)) |
| 5674 | rootn(float v, int n); |
| 5675 | |
| 5676 | extern float2 __attribute__((const, overloadable)) |
| 5677 | rootn(float2 v, int2 n); |
| 5678 | |
| 5679 | extern float3 __attribute__((const, overloadable)) |
| 5680 | rootn(float3 v, int3 n); |
| 5681 | |
| 5682 | extern float4 __attribute__((const, overloadable)) |
| 5683 | rootn(float4 v, int4 n); |
| 5684 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5685 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5686 | extern half __attribute__((const, overloadable)) |
| 5687 | rootn(half v, int n); |
| 5688 | #endif |
| 5689 | |
| 5690 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5691 | extern half2 __attribute__((const, overloadable)) |
| 5692 | rootn(half2 v, int2 n); |
| 5693 | #endif |
| 5694 | |
| 5695 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5696 | extern half3 __attribute__((const, overloadable)) |
| 5697 | rootn(half3 v, int3 n); |
| 5698 | #endif |
| 5699 | |
| 5700 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5701 | extern half4 __attribute__((const, overloadable)) |
| 5702 | rootn(half4 v, int4 n); |
| 5703 | #endif |
| 5704 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5705 | /* |
| 5706 | * round: Round away from zero |
| 5707 | * |
| 5708 | * Round to the nearest integral value. |
| 5709 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5710 | * round() rounds half values away from zero. For example, round(0.5f) returns 1.f |
| 5711 | * and round(1.5f) returns 2.f. Similarly, round(-0.5f) returns -1.f |
| 5712 | * and round(-1.5f) returns -2.f. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5713 | * |
| 5714 | * rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction. |
| 5715 | */ |
| 5716 | extern float __attribute__((const, overloadable)) |
| 5717 | round(float v); |
| 5718 | |
| 5719 | extern float2 __attribute__((const, overloadable)) |
| 5720 | round(float2 v); |
| 5721 | |
| 5722 | extern float3 __attribute__((const, overloadable)) |
| 5723 | round(float3 v); |
| 5724 | |
| 5725 | extern float4 __attribute__((const, overloadable)) |
| 5726 | round(float4 v); |
| 5727 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5728 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5729 | extern half __attribute__((const, overloadable)) |
| 5730 | round(half v); |
| 5731 | #endif |
| 5732 | |
| 5733 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5734 | extern half2 __attribute__((const, overloadable)) |
| 5735 | round(half2 v); |
| 5736 | #endif |
| 5737 | |
| 5738 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5739 | extern half3 __attribute__((const, overloadable)) |
| 5740 | round(half3 v); |
| 5741 | #endif |
| 5742 | |
| 5743 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5744 | extern half4 __attribute__((const, overloadable)) |
| 5745 | round(half4 v); |
| 5746 | #endif |
| 5747 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5748 | /* |
| 5749 | * rsqrt: Reciprocal of a square root |
| 5750 | * |
| 5751 | * Returns (1 / sqrt(v)). |
| 5752 | * |
| 5753 | * See also half_rsqrt(), native_rsqrt(). |
| 5754 | */ |
| 5755 | extern float __attribute__((const, overloadable)) |
| 5756 | rsqrt(float v); |
| 5757 | |
| 5758 | extern float2 __attribute__((const, overloadable)) |
| 5759 | rsqrt(float2 v); |
| 5760 | |
| 5761 | extern float3 __attribute__((const, overloadable)) |
| 5762 | rsqrt(float3 v); |
| 5763 | |
| 5764 | extern float4 __attribute__((const, overloadable)) |
| 5765 | rsqrt(float4 v); |
| 5766 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5767 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5768 | extern half __attribute__((const, overloadable)) |
| 5769 | rsqrt(half v); |
| 5770 | #endif |
| 5771 | |
| 5772 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5773 | extern half2 __attribute__((const, overloadable)) |
| 5774 | rsqrt(half2 v); |
| 5775 | #endif |
| 5776 | |
| 5777 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5778 | extern half3 __attribute__((const, overloadable)) |
| 5779 | rsqrt(half3 v); |
| 5780 | #endif |
| 5781 | |
| 5782 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5783 | extern half4 __attribute__((const, overloadable)) |
| 5784 | rsqrt(half4 v); |
| 5785 | #endif |
| 5786 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5787 | /* |
| 5788 | * sign: Sign of a value |
| 5789 | * |
| 5790 | * Returns the sign of a value. |
| 5791 | * |
| 5792 | * if (v < 0) return -1.f; |
| 5793 | * else if (v > 0) return 1.f; |
| 5794 | * else return 0.f; |
| 5795 | */ |
| 5796 | extern float __attribute__((const, overloadable)) |
| 5797 | sign(float v); |
| 5798 | |
| 5799 | extern float2 __attribute__((const, overloadable)) |
| 5800 | sign(float2 v); |
| 5801 | |
| 5802 | extern float3 __attribute__((const, overloadable)) |
| 5803 | sign(float3 v); |
| 5804 | |
| 5805 | extern float4 __attribute__((const, overloadable)) |
| 5806 | sign(float4 v); |
| 5807 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5808 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5809 | extern half __attribute__((const, overloadable)) |
| 5810 | sign(half v); |
| 5811 | #endif |
| 5812 | |
| 5813 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5814 | extern half2 __attribute__((const, overloadable)) |
| 5815 | sign(half2 v); |
| 5816 | #endif |
| 5817 | |
| 5818 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5819 | extern half3 __attribute__((const, overloadable)) |
| 5820 | sign(half3 v); |
| 5821 | #endif |
| 5822 | |
| 5823 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5824 | extern half4 __attribute__((const, overloadable)) |
| 5825 | sign(half4 v); |
| 5826 | #endif |
| 5827 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5828 | /* |
| 5829 | * sin: Sine |
| 5830 | * |
| 5831 | * Returns the sine of an angle measured in radians. |
| 5832 | * |
| 5833 | * See also native_sin(). |
| 5834 | */ |
| 5835 | extern float __attribute__((const, overloadable)) |
| 5836 | sin(float v); |
| 5837 | |
| 5838 | extern float2 __attribute__((const, overloadable)) |
| 5839 | sin(float2 v); |
| 5840 | |
| 5841 | extern float3 __attribute__((const, overloadable)) |
| 5842 | sin(float3 v); |
| 5843 | |
| 5844 | extern float4 __attribute__((const, overloadable)) |
| 5845 | sin(float4 v); |
| 5846 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5847 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5848 | extern half __attribute__((const, overloadable)) |
| 5849 | sin(half v); |
| 5850 | #endif |
| 5851 | |
| 5852 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5853 | extern half2 __attribute__((const, overloadable)) |
| 5854 | sin(half2 v); |
| 5855 | #endif |
| 5856 | |
| 5857 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5858 | extern half3 __attribute__((const, overloadable)) |
| 5859 | sin(half3 v); |
| 5860 | #endif |
| 5861 | |
| 5862 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5863 | extern half4 __attribute__((const, overloadable)) |
| 5864 | sin(half4 v); |
| 5865 | #endif |
| 5866 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5867 | /* |
| 5868 | * sincos: Sine and cosine |
| 5869 | * |
| 5870 | * Returns the sine and cosine of a value. |
| 5871 | * |
| 5872 | * See also native_sincos(). |
| 5873 | * |
| 5874 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5875 | * v: Incoming value in radians. |
Jean-Luc Brouillet | 4a73004 | 2015-04-02 16:15:25 -0700 | [diff] [blame] | 5876 | * cos: *cos will be set to the cosine value. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5877 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 5878 | * Returns: Sine of v. |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5879 | */ |
| 5880 | extern float __attribute__((overloadable)) |
| 5881 | sincos(float v, float* cos); |
| 5882 | |
| 5883 | extern float2 __attribute__((overloadable)) |
| 5884 | sincos(float2 v, float2* cos); |
| 5885 | |
| 5886 | extern float3 __attribute__((overloadable)) |
| 5887 | sincos(float3 v, float3* cos); |
| 5888 | |
| 5889 | extern float4 __attribute__((overloadable)) |
| 5890 | sincos(float4 v, float4* cos); |
| 5891 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5892 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5893 | extern half __attribute__((overloadable)) |
| 5894 | sincos(half v, half* cos); |
| 5895 | #endif |
| 5896 | |
| 5897 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5898 | extern half2 __attribute__((overloadable)) |
| 5899 | sincos(half2 v, half2* cos); |
| 5900 | #endif |
| 5901 | |
| 5902 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5903 | extern half3 __attribute__((overloadable)) |
| 5904 | sincos(half3 v, half3* cos); |
| 5905 | #endif |
| 5906 | |
| 5907 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5908 | extern half4 __attribute__((overloadable)) |
| 5909 | sincos(half4 v, half4* cos); |
| 5910 | #endif |
| 5911 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5912 | /* |
| 5913 | * sinh: Hyperbolic sine |
| 5914 | * |
| 5915 | * Returns the hyperbolic sine of v, where v is measured in radians. |
| 5916 | * |
| 5917 | * See also native_sinh(). |
| 5918 | */ |
| 5919 | extern float __attribute__((const, overloadable)) |
| 5920 | sinh(float v); |
| 5921 | |
| 5922 | extern float2 __attribute__((const, overloadable)) |
| 5923 | sinh(float2 v); |
| 5924 | |
| 5925 | extern float3 __attribute__((const, overloadable)) |
| 5926 | sinh(float3 v); |
| 5927 | |
| 5928 | extern float4 __attribute__((const, overloadable)) |
| 5929 | sinh(float4 v); |
| 5930 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5931 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5932 | extern half __attribute__((const, overloadable)) |
| 5933 | sinh(half v); |
| 5934 | #endif |
| 5935 | |
| 5936 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5937 | extern half2 __attribute__((const, overloadable)) |
| 5938 | sinh(half2 v); |
| 5939 | #endif |
| 5940 | |
| 5941 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5942 | extern half3 __attribute__((const, overloadable)) |
| 5943 | sinh(half3 v); |
| 5944 | #endif |
| 5945 | |
| 5946 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5947 | extern half4 __attribute__((const, overloadable)) |
| 5948 | sinh(half4 v); |
| 5949 | #endif |
| 5950 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5951 | /* |
| 5952 | * sinpi: Sine of a number multiplied by pi |
| 5953 | * |
| 5954 | * Returns the sine of (v * pi), where (v * pi) is measured in radians. |
| 5955 | * |
| 5956 | * To get the sine of a value measured in degrees, call sinpi(v / 180.f). |
| 5957 | * |
| 5958 | * See also native_sinpi(). |
| 5959 | */ |
| 5960 | extern float __attribute__((const, overloadable)) |
| 5961 | sinpi(float v); |
| 5962 | |
| 5963 | extern float2 __attribute__((const, overloadable)) |
| 5964 | sinpi(float2 v); |
| 5965 | |
| 5966 | extern float3 __attribute__((const, overloadable)) |
| 5967 | sinpi(float3 v); |
| 5968 | |
| 5969 | extern float4 __attribute__((const, overloadable)) |
| 5970 | sinpi(float4 v); |
| 5971 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 5972 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5973 | extern half __attribute__((const, overloadable)) |
| 5974 | sinpi(half v); |
| 5975 | #endif |
| 5976 | |
| 5977 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5978 | extern half2 __attribute__((const, overloadable)) |
| 5979 | sinpi(half2 v); |
| 5980 | #endif |
| 5981 | |
| 5982 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5983 | extern half3 __attribute__((const, overloadable)) |
| 5984 | sinpi(half3 v); |
| 5985 | #endif |
| 5986 | |
| 5987 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 5988 | extern half4 __attribute__((const, overloadable)) |
| 5989 | sinpi(half4 v); |
| 5990 | #endif |
| 5991 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 5992 | /* |
| 5993 | * sqrt: Square root |
| 5994 | * |
| 5995 | * Returns the square root of a value. |
| 5996 | * |
| 5997 | * See also half_sqrt(), native_sqrt(). |
| 5998 | */ |
| 5999 | extern float __attribute__((const, overloadable)) |
| 6000 | sqrt(float v); |
| 6001 | |
| 6002 | extern float2 __attribute__((const, overloadable)) |
| 6003 | sqrt(float2 v); |
| 6004 | |
| 6005 | extern float3 __attribute__((const, overloadable)) |
| 6006 | sqrt(float3 v); |
| 6007 | |
| 6008 | extern float4 __attribute__((const, overloadable)) |
| 6009 | sqrt(float4 v); |
| 6010 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6011 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6012 | extern half __attribute__((const, overloadable)) |
| 6013 | sqrt(half v); |
| 6014 | #endif |
| 6015 | |
| 6016 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6017 | extern half2 __attribute__((const, overloadable)) |
| 6018 | sqrt(half2 v); |
| 6019 | #endif |
| 6020 | |
| 6021 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6022 | extern half3 __attribute__((const, overloadable)) |
| 6023 | sqrt(half3 v); |
| 6024 | #endif |
| 6025 | |
| 6026 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6027 | extern half4 __attribute__((const, overloadable)) |
| 6028 | sqrt(half4 v); |
| 6029 | #endif |
| 6030 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6031 | /* |
| 6032 | * step: 0 if less than a value, 0 otherwise |
| 6033 | * |
| 6034 | * Returns 0.f if v < edge, 1.f otherwise. |
| 6035 | * |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 6036 | * This can be useful to create conditional computations without using loops and branching |
| 6037 | * instructions. For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) |
| 6038 | * 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] | 6039 | */ |
| 6040 | extern float __attribute__((const, overloadable)) |
| 6041 | step(float edge, float v); |
| 6042 | |
| 6043 | extern float2 __attribute__((const, overloadable)) |
| 6044 | step(float2 edge, float2 v); |
| 6045 | |
| 6046 | extern float3 __attribute__((const, overloadable)) |
| 6047 | step(float3 edge, float3 v); |
| 6048 | |
| 6049 | extern float4 __attribute__((const, overloadable)) |
| 6050 | step(float4 edge, float4 v); |
| 6051 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6052 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6053 | extern half __attribute__((const, overloadable)) |
| 6054 | step(half edge, half v); |
| 6055 | #endif |
| 6056 | |
| 6057 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6058 | extern half2 __attribute__((const, overloadable)) |
| 6059 | step(half2 edge, half2 v); |
| 6060 | #endif |
| 6061 | |
| 6062 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6063 | extern half3 __attribute__((const, overloadable)) |
| 6064 | step(half3 edge, half3 v); |
| 6065 | #endif |
| 6066 | |
| 6067 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6068 | extern half4 __attribute__((const, overloadable)) |
| 6069 | step(half4 edge, half4 v); |
| 6070 | #endif |
| 6071 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6072 | extern float2 __attribute__((const, overloadable)) |
| 6073 | step(float2 edge, float v); |
| 6074 | |
| 6075 | extern float3 __attribute__((const, overloadable)) |
| 6076 | step(float3 edge, float v); |
| 6077 | |
| 6078 | extern float4 __attribute__((const, overloadable)) |
| 6079 | step(float4 edge, float v); |
| 6080 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6081 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6082 | extern half2 __attribute__((const, overloadable)) |
| 6083 | step(half2 edge, half v); |
| 6084 | #endif |
| 6085 | |
| 6086 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6087 | extern half3 __attribute__((const, overloadable)) |
| 6088 | step(half3 edge, half v); |
| 6089 | #endif |
| 6090 | |
| 6091 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6092 | extern half4 __attribute__((const, overloadable)) |
| 6093 | step(half4 edge, half v); |
| 6094 | #endif |
| 6095 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6096 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 6097 | extern float2 __attribute__((const, overloadable)) |
| 6098 | step(float edge, float2 v); |
| 6099 | #endif |
| 6100 | |
| 6101 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 6102 | extern float3 __attribute__((const, overloadable)) |
| 6103 | step(float edge, float3 v); |
| 6104 | #endif |
| 6105 | |
| 6106 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 6107 | extern float4 __attribute__((const, overloadable)) |
| 6108 | step(float edge, float4 v); |
| 6109 | #endif |
| 6110 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6111 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6112 | extern half2 __attribute__((const, overloadable)) |
| 6113 | step(half edge, half2 v); |
| 6114 | #endif |
| 6115 | |
| 6116 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6117 | extern half3 __attribute__((const, overloadable)) |
| 6118 | step(half edge, half3 v); |
| 6119 | #endif |
| 6120 | |
| 6121 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6122 | extern half4 __attribute__((const, overloadable)) |
| 6123 | step(half edge, half4 v); |
| 6124 | #endif |
| 6125 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6126 | /* |
| 6127 | * tan: Tangent |
| 6128 | * |
| 6129 | * Returns the tangent of an angle measured in radians. |
| 6130 | * |
| 6131 | * See also native_tan(). |
| 6132 | */ |
| 6133 | extern float __attribute__((const, overloadable)) |
| 6134 | tan(float v); |
| 6135 | |
| 6136 | extern float2 __attribute__((const, overloadable)) |
| 6137 | tan(float2 v); |
| 6138 | |
| 6139 | extern float3 __attribute__((const, overloadable)) |
| 6140 | tan(float3 v); |
| 6141 | |
| 6142 | extern float4 __attribute__((const, overloadable)) |
| 6143 | tan(float4 v); |
| 6144 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6145 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6146 | extern half __attribute__((const, overloadable)) |
| 6147 | tan(half v); |
| 6148 | #endif |
| 6149 | |
| 6150 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6151 | extern half2 __attribute__((const, overloadable)) |
| 6152 | tan(half2 v); |
| 6153 | #endif |
| 6154 | |
| 6155 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6156 | extern half3 __attribute__((const, overloadable)) |
| 6157 | tan(half3 v); |
| 6158 | #endif |
| 6159 | |
| 6160 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6161 | extern half4 __attribute__((const, overloadable)) |
| 6162 | tan(half4 v); |
| 6163 | #endif |
| 6164 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6165 | /* |
| 6166 | * tanh: Hyperbolic tangent |
| 6167 | * |
| 6168 | * Returns the hyperbolic tangent of a value. |
| 6169 | * |
| 6170 | * See also native_tanh(). |
| 6171 | */ |
| 6172 | extern float __attribute__((const, overloadable)) |
| 6173 | tanh(float v); |
| 6174 | |
| 6175 | extern float2 __attribute__((const, overloadable)) |
| 6176 | tanh(float2 v); |
| 6177 | |
| 6178 | extern float3 __attribute__((const, overloadable)) |
| 6179 | tanh(float3 v); |
| 6180 | |
| 6181 | extern float4 __attribute__((const, overloadable)) |
| 6182 | tanh(float4 v); |
| 6183 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6184 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6185 | extern half __attribute__((const, overloadable)) |
| 6186 | tanh(half v); |
| 6187 | #endif |
| 6188 | |
| 6189 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6190 | extern half2 __attribute__((const, overloadable)) |
| 6191 | tanh(half2 v); |
| 6192 | #endif |
| 6193 | |
| 6194 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6195 | extern half3 __attribute__((const, overloadable)) |
| 6196 | tanh(half3 v); |
| 6197 | #endif |
| 6198 | |
| 6199 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6200 | extern half4 __attribute__((const, overloadable)) |
| 6201 | tanh(half4 v); |
| 6202 | #endif |
| 6203 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6204 | /* |
| 6205 | * tanpi: Tangent of a number multiplied by pi |
| 6206 | * |
| 6207 | * Returns the tangent of (v * pi), where (v * pi) is measured in radians. |
| 6208 | * |
| 6209 | * To get the tangent of a value measured in degrees, call tanpi(v / 180.f). |
| 6210 | * |
| 6211 | * See also native_tanpi(). |
| 6212 | */ |
| 6213 | extern float __attribute__((const, overloadable)) |
| 6214 | tanpi(float v); |
| 6215 | |
| 6216 | extern float2 __attribute__((const, overloadable)) |
| 6217 | tanpi(float2 v); |
| 6218 | |
| 6219 | extern float3 __attribute__((const, overloadable)) |
| 6220 | tanpi(float3 v); |
| 6221 | |
| 6222 | extern float4 __attribute__((const, overloadable)) |
| 6223 | tanpi(float4 v); |
| 6224 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6225 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6226 | extern half __attribute__((const, overloadable)) |
| 6227 | tanpi(half v); |
| 6228 | #endif |
| 6229 | |
| 6230 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6231 | extern half2 __attribute__((const, overloadable)) |
| 6232 | tanpi(half2 v); |
| 6233 | #endif |
| 6234 | |
| 6235 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6236 | extern half3 __attribute__((const, overloadable)) |
| 6237 | tanpi(half3 v); |
| 6238 | #endif |
| 6239 | |
| 6240 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6241 | extern half4 __attribute__((const, overloadable)) |
| 6242 | tanpi(half4 v); |
| 6243 | #endif |
| 6244 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6245 | /* |
| 6246 | * tgamma: Gamma function |
| 6247 | * |
| 6248 | * Returns the gamma function of a value. |
| 6249 | * |
| 6250 | * See also lgamma(). |
| 6251 | */ |
| 6252 | extern float __attribute__((const, overloadable)) |
| 6253 | tgamma(float v); |
| 6254 | |
| 6255 | extern float2 __attribute__((const, overloadable)) |
| 6256 | tgamma(float2 v); |
| 6257 | |
| 6258 | extern float3 __attribute__((const, overloadable)) |
| 6259 | tgamma(float3 v); |
| 6260 | |
| 6261 | extern float4 __attribute__((const, overloadable)) |
| 6262 | tgamma(float4 v); |
| 6263 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6264 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6265 | extern half __attribute__((const, overloadable)) |
| 6266 | tgamma(half v); |
| 6267 | #endif |
| 6268 | |
| 6269 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6270 | extern half2 __attribute__((const, overloadable)) |
| 6271 | tgamma(half2 v); |
| 6272 | #endif |
| 6273 | |
| 6274 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6275 | extern half3 __attribute__((const, overloadable)) |
| 6276 | tgamma(half3 v); |
| 6277 | #endif |
| 6278 | |
| 6279 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6280 | extern half4 __attribute__((const, overloadable)) |
| 6281 | tgamma(half4 v); |
| 6282 | #endif |
| 6283 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6284 | /* |
| 6285 | * trunc: Truncates a floating point |
| 6286 | * |
| 6287 | * Rounds to integral using truncation. |
| 6288 | * |
| 6289 | * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f. |
| 6290 | * |
| 6291 | * See rint() and round() for other rounding options. |
| 6292 | */ |
| 6293 | extern float __attribute__((const, overloadable)) |
| 6294 | trunc(float v); |
| 6295 | |
| 6296 | extern float2 __attribute__((const, overloadable)) |
| 6297 | trunc(float2 v); |
| 6298 | |
| 6299 | extern float3 __attribute__((const, overloadable)) |
| 6300 | trunc(float3 v); |
| 6301 | |
| 6302 | extern float4 __attribute__((const, overloadable)) |
| 6303 | trunc(float4 v); |
| 6304 | |
Pirama Arumuga Nainar | 586539c | 2015-12-09 15:56:03 -0800 | [diff] [blame] | 6305 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6306 | extern half __attribute__((const, overloadable)) |
| 6307 | trunc(half v); |
| 6308 | #endif |
| 6309 | |
| 6310 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6311 | extern half2 __attribute__((const, overloadable)) |
| 6312 | trunc(half2 v); |
| 6313 | #endif |
| 6314 | |
| 6315 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6316 | extern half3 __attribute__((const, overloadable)) |
| 6317 | trunc(half3 v); |
| 6318 | #endif |
| 6319 | |
| 6320 | #if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295)) |
| 6321 | extern half4 __attribute__((const, overloadable)) |
| 6322 | trunc(half4 v); |
| 6323 | #endif |
| 6324 | |
Jean-Luc Brouillet | be21638 | 2015-03-22 12:44:27 -0700 | [diff] [blame] | 6325 | /* |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6326 | * rsClamp: Restrain a value to a range |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 6327 | * |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 6328 | * DEPRECATED. Do not use. |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 6329 | * |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 6330 | * Clamp a value between low and high. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6331 | * |
| 6332 | * Parameters: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 6333 | * amount: Value to clamp. |
| 6334 | * low: Lower bound. |
| 6335 | * high: Upper bound. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 6336 | */ |
Verena Beckham | a4d25bc | 2015-11-12 14:20:31 +0000 | [diff] [blame] | 6337 | extern char __attribute__((const, overloadable |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6338 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6339 | , deprecated("Use clamp() instead.") |
| 6340 | #endif |
| 6341 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6342 | rsClamp(char amount, char low, char high); |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 6343 | |
Verena Beckham | a4d25bc | 2015-11-12 14:20:31 +0000 | [diff] [blame] | 6344 | extern uchar __attribute__((const, overloadable |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6345 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6346 | , deprecated("Use clamp() instead.") |
| 6347 | #endif |
| 6348 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6349 | rsClamp(uchar amount, uchar low, uchar high); |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 6350 | |
Verena Beckham | a4d25bc | 2015-11-12 14:20:31 +0000 | [diff] [blame] | 6351 | extern short __attribute__((const, overloadable |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6352 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6353 | , deprecated("Use clamp() instead.") |
| 6354 | #endif |
| 6355 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6356 | rsClamp(short amount, short low, short high); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 6357 | |
Verena Beckham | a4d25bc | 2015-11-12 14:20:31 +0000 | [diff] [blame] | 6358 | extern ushort __attribute__((const, overloadable |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6359 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6360 | , deprecated("Use clamp() instead.") |
| 6361 | #endif |
| 6362 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6363 | rsClamp(ushort amount, ushort low, ushort high); |
| 6364 | |
Verena Beckham | a4d25bc | 2015-11-12 14:20:31 +0000 | [diff] [blame] | 6365 | extern int __attribute__((const, overloadable |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6366 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6367 | , deprecated("Use clamp() instead.") |
| 6368 | #endif |
| 6369 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6370 | rsClamp(int amount, int low, int high); |
| 6371 | |
Verena Beckham | a4d25bc | 2015-11-12 14:20:31 +0000 | [diff] [blame] | 6372 | extern uint __attribute__((const, overloadable |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6373 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6374 | , deprecated("Use clamp() instead.") |
| 6375 | #endif |
| 6376 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6377 | rsClamp(uint amount, uint low, uint high); |
| 6378 | |
| 6379 | /* |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 6380 | * rsFrac: Returns the fractional part of a float |
| 6381 | * |
| 6382 | * DEPRECATED. Do not use. |
| 6383 | * |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6384 | * Returns the fractional part of a float |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 6385 | */ |
Jean-Luc Brouillet | 36e2be5 | 2015-04-30 14:41:24 -0700 | [diff] [blame] | 6386 | extern float __attribute__((const, overloadable |
| 6387 | #if (defined(RS_VERSION) && (RS_VERSION >= 22)) |
| 6388 | , deprecated("Use fract() instead.") |
| 6389 | #endif |
| 6390 | )) |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6391 | rsFrac(float v); |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 6392 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6393 | /* |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 6394 | * rsRand: Pseudo-random number |
| 6395 | * |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6396 | * Return a random value between 0 (or min_value) and max_malue. |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 6397 | */ |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6398 | extern int __attribute__((overloadable)) |
| 6399 | rsRand(int max_value); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 6400 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6401 | extern int __attribute__((overloadable)) |
| 6402 | rsRand(int min_value, int max_value); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 6403 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6404 | extern float __attribute__((overloadable)) |
| 6405 | rsRand(float max_value); |
Jason Sams | e1eb615 | 2011-06-21 16:42:30 -0700 | [diff] [blame] | 6406 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6407 | extern float __attribute__((overloadable)) |
| 6408 | rsRand(float min_value, float max_value); |
| 6409 | |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 6410 | #endif // RENDERSCRIPT_RS_MATH_RSH |