blob: 3d034d094c906dc6fd950ce9d1474d50051e33cd [file] [log] [blame]
Jason Sams044e2ee2011-08-08 16:52:30 -07001/*
Stephen Hines2cfa2052016-02-11 21:29:22 -08002 * Copyright (C) 2016 The Android Open Source Project
Jason Sams044e2ee2011-08-08 16:52:30 -07003 *
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 Brouillet4a730042015-04-02 16:15:25 -070017// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070018
19/*
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070020 * rs_math.rsh: Mathematical Constants and Functions
Jason Sams9df3b2b2011-08-08 14:31:25 -070021 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070022 * 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 Brouilletbe216382015-03-22 12:44:27 -070024 *
25 * For example:
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070026 * 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 Brouillet6386ceb2015-04-28 15:06:30 -070034 * 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 Brouilletbe216382015-03-22 12:44:27 -070036 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070037 * 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 Brouilletbe216382015-03-22 12:44:27 -070042 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070043 * 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 Brouilletbe216382015-03-22 12:44:27 -070050 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070051 */
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -070052
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070053#ifndef RENDERSCRIPT_RS_MATH_RSH
54#define RENDERSCRIPT_RS_MATH_RSH
55
56/*
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070057 * 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 Brouillet20b27d62015-04-03 14:39:53 -070071 * M_2_PIl: 2 / pi, as a 32 bit float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070072 *
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070073 * DEPRECATED. Do not use.
74 *
75 * 2 divided by pi, as a 32 bit float.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070076 */
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 */
163extern uchar __attribute__((const, overloadable))
164 abs(char v);
165
166extern uchar2 __attribute__((const, overloadable))
167 abs(char2 v);
168
169extern uchar3 __attribute__((const, overloadable))
170 abs(char3 v);
171
172extern uchar4 __attribute__((const, overloadable))
173 abs(char4 v);
174
175extern ushort __attribute__((const, overloadable))
176 abs(short v);
177
178extern ushort2 __attribute__((const, overloadable))
179 abs(short2 v);
180
181extern ushort3 __attribute__((const, overloadable))
182 abs(short3 v);
183
184extern ushort4 __attribute__((const, overloadable))
185 abs(short4 v);
186
187extern uint __attribute__((const, overloadable))
188 abs(int v);
189
190extern uint2 __attribute__((const, overloadable))
191 abs(int2 v);
192
193extern uint3 __attribute__((const, overloadable))
194 abs(int3 v);
195
196extern 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 */
206extern float __attribute__((const, overloadable))
207 acos(float v);
208
209extern float2 __attribute__((const, overloadable))
210 acos(float2 v);
211
212extern float3 __attribute__((const, overloadable))
213 acos(float3 v);
214
215extern float4 __attribute__((const, overloadable))
216 acos(float4 v);
217
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800218#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800219extern half __attribute__((const, overloadable))
220 acos(half v);
221#endif
222
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800223#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800224extern half2 __attribute__((const, overloadable))
225 acos(half2 v);
226#endif
227
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800228#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800229extern half3 __attribute__((const, overloadable))
230 acos(half3 v);
231#endif
232
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800233#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800234extern half4 __attribute__((const, overloadable))
235 acos(half4 v);
236#endif
237
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700238/*
239 * acosh: Inverse hyperbolic cosine
240 *
241 * Returns the inverse hyperbolic cosine, in radians.
242 *
243 * See also native_acosh().
244 */
245extern float __attribute__((const, overloadable))
246 acosh(float v);
247
248extern float2 __attribute__((const, overloadable))
249 acosh(float2 v);
250
251extern float3 __attribute__((const, overloadable))
252 acosh(float3 v);
253
254extern float4 __attribute__((const, overloadable))
255 acosh(float4 v);
256
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800257#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800258extern half __attribute__((const, overloadable))
259 acosh(half v);
260#endif
261
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800262#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800263extern half2 __attribute__((const, overloadable))
264 acosh(half2 v);
265#endif
266
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800267#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800268extern half3 __attribute__((const, overloadable))
269 acosh(half3 v);
270#endif
271
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800272#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800273extern half4 __attribute__((const, overloadable))
274 acosh(half4 v);
275#endif
276
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700277/*
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 */
286extern float __attribute__((const, overloadable))
287 acospi(float v);
288
289extern float2 __attribute__((const, overloadable))
290 acospi(float2 v);
291
292extern float3 __attribute__((const, overloadable))
293 acospi(float3 v);
294
295extern float4 __attribute__((const, overloadable))
296 acospi(float4 v);
297
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800298#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800299extern half __attribute__((const, overloadable))
300 acospi(half v);
301#endif
302
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800303#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800304extern half2 __attribute__((const, overloadable))
305 acospi(half2 v);
306#endif
307
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800308#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800309extern half3 __attribute__((const, overloadable))
310 acospi(half3 v);
311#endif
312
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800313#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800314extern half4 __attribute__((const, overloadable))
315 acospi(half4 v);
316#endif
317
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700318/*
319 * asin: Inverse sine
320 *
321 * Returns the inverse sine, in radians.
322 *
323 * See also native_asin().
324 */
325extern float __attribute__((const, overloadable))
326 asin(float v);
327
328extern float2 __attribute__((const, overloadable))
329 asin(float2 v);
330
331extern float3 __attribute__((const, overloadable))
332 asin(float3 v);
333
334extern float4 __attribute__((const, overloadable))
335 asin(float4 v);
336
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800337#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800338extern half __attribute__((const, overloadable))
339 asin(half v);
340#endif
341
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800342#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800343extern half2 __attribute__((const, overloadable))
344 asin(half2 v);
345#endif
346
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800347#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800348extern half3 __attribute__((const, overloadable))
349 asin(half3 v);
350#endif
351
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800352#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800353extern half4 __attribute__((const, overloadable))
354 asin(half4 v);
355#endif
356
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700357/*
358 * asinh: Inverse hyperbolic sine
359 *
360 * Returns the inverse hyperbolic sine, in radians.
361 *
362 * See also native_asinh().
363 */
364extern float __attribute__((const, overloadable))
365 asinh(float v);
366
367extern float2 __attribute__((const, overloadable))
368 asinh(float2 v);
369
370extern float3 __attribute__((const, overloadable))
371 asinh(float3 v);
372
373extern float4 __attribute__((const, overloadable))
374 asinh(float4 v);
375
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800376#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800377extern half __attribute__((const, overloadable))
378 asinh(half v);
379#endif
380
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800381#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800382extern half2 __attribute__((const, overloadable))
383 asinh(half2 v);
384#endif
385
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800386#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800387extern half3 __attribute__((const, overloadable))
388 asinh(half3 v);
389#endif
390
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800391#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800392extern half4 __attribute__((const, overloadable))
393 asinh(half4 v);
394#endif
395
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700396/*
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 */
405extern float __attribute__((const, overloadable))
406 asinpi(float v);
407
408extern float2 __attribute__((const, overloadable))
409 asinpi(float2 v);
410
411extern float3 __attribute__((const, overloadable))
412 asinpi(float3 v);
413
414extern float4 __attribute__((const, overloadable))
415 asinpi(float4 v);
416
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800417#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800418extern half __attribute__((const, overloadable))
419 asinpi(half v);
420#endif
421
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800422#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800423extern half2 __attribute__((const, overloadable))
424 asinpi(half2 v);
425#endif
426
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800427#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800428extern half3 __attribute__((const, overloadable))
429 asinpi(half3 v);
430#endif
431
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800432#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800433extern half4 __attribute__((const, overloadable))
434 asinpi(half4 v);
435#endif
436
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700437/*
438 * atan: Inverse tangent
439 *
440 * Returns the inverse tangent, in radians.
441 *
442 * See also native_atan().
443 */
444extern float __attribute__((const, overloadable))
445 atan(float v);
446
447extern float2 __attribute__((const, overloadable))
448 atan(float2 v);
449
450extern float3 __attribute__((const, overloadable))
451 atan(float3 v);
452
453extern float4 __attribute__((const, overloadable))
454 atan(float4 v);
455
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800456#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800457extern half __attribute__((const, overloadable))
458 atan(half v);
459#endif
460
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800461#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800462extern half2 __attribute__((const, overloadable))
463 atan(half2 v);
464#endif
465
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800466#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800467extern half3 __attribute__((const, overloadable))
468 atan(half3 v);
469#endif
470
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800471#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800472extern half4 __attribute__((const, overloadable))
473 atan(half4 v);
474#endif
475
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700476/*
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 Brouillet6386ceb2015-04-28 15:06:30 -0700484 * numerator: Numerator.
485 * denominator: Denominator. Can be 0.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700486 */
487extern float __attribute__((const, overloadable))
488 atan2(float numerator, float denominator);
489
490extern float2 __attribute__((const, overloadable))
491 atan2(float2 numerator, float2 denominator);
492
493extern float3 __attribute__((const, overloadable))
494 atan2(float3 numerator, float3 denominator);
495
496extern float4 __attribute__((const, overloadable))
497 atan2(float4 numerator, float4 denominator);
498
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800499#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800500extern half __attribute__((const, overloadable))
501 atan2(half numerator, half denominator);
502#endif
503
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800504#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800505extern half2 __attribute__((const, overloadable))
506 atan2(half2 numerator, half2 denominator);
507#endif
508
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800509#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800510extern half3 __attribute__((const, overloadable))
511 atan2(half3 numerator, half3 denominator);
512#endif
513
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800514#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800515extern half4 __attribute__((const, overloadable))
516 atan2(half4 numerator, half4 denominator);
517#endif
518
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700519/*
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 Brouillet6386ceb2015-04-28 15:06:30 -0700529 * numerator: Numerator.
530 * denominator: Denominator. Can be 0.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700531 */
532extern float __attribute__((const, overloadable))
533 atan2pi(float numerator, float denominator);
534
535extern float2 __attribute__((const, overloadable))
536 atan2pi(float2 numerator, float2 denominator);
537
538extern float3 __attribute__((const, overloadable))
539 atan2pi(float3 numerator, float3 denominator);
540
541extern float4 __attribute__((const, overloadable))
542 atan2pi(float4 numerator, float4 denominator);
543
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800544#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800545extern half __attribute__((const, overloadable))
546 atan2pi(half numerator, half denominator);
547#endif
548
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800549#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800550extern half2 __attribute__((const, overloadable))
551 atan2pi(half2 numerator, half2 denominator);
552#endif
553
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800554#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800555extern half3 __attribute__((const, overloadable))
556 atan2pi(half3 numerator, half3 denominator);
557#endif
558
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800559#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800560extern half4 __attribute__((const, overloadable))
561 atan2pi(half4 numerator, half4 denominator);
562#endif
563
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700564/*
565 * atanh: Inverse hyperbolic tangent
566 *
567 * Returns the inverse hyperbolic tangent, in radians.
568 *
569 * See also native_atanh().
570 */
571extern float __attribute__((const, overloadable))
572 atanh(float v);
573
574extern float2 __attribute__((const, overloadable))
575 atanh(float2 v);
576
577extern float3 __attribute__((const, overloadable))
578 atanh(float3 v);
579
580extern float4 __attribute__((const, overloadable))
581 atanh(float4 v);
582
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800583#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800584extern half __attribute__((const, overloadable))
585 atanh(half v);
586#endif
587
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800588#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800589extern half2 __attribute__((const, overloadable))
590 atanh(half2 v);
591#endif
592
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800593#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800594extern half3 __attribute__((const, overloadable))
595 atanh(half3 v);
596#endif
597
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800598#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800599extern half4 __attribute__((const, overloadable))
600 atanh(half4 v);
601#endif
602
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700603/*
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 */
612extern float __attribute__((const, overloadable))
613 atanpi(float v);
614
615extern float2 __attribute__((const, overloadable))
616 atanpi(float2 v);
617
618extern float3 __attribute__((const, overloadable))
619 atanpi(float3 v);
620
621extern float4 __attribute__((const, overloadable))
622 atanpi(float4 v);
623
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800624#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800625extern half __attribute__((const, overloadable))
626 atanpi(half v);
627#endif
628
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800629#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800630extern half2 __attribute__((const, overloadable))
631 atanpi(half2 v);
632#endif
633
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800634#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800635extern half3 __attribute__((const, overloadable))
636 atanpi(half3 v);
637#endif
638
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800639#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800640extern half4 __attribute__((const, overloadable))
641 atanpi(half4 v);
642#endif
643
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700644/*
645 * cbrt: Cube root
646 *
647 * Returns the cube root.
648 *
649 * See also native_cbrt().
650 */
651extern float __attribute__((const, overloadable))
652 cbrt(float v);
653
654extern float2 __attribute__((const, overloadable))
655 cbrt(float2 v);
656
657extern float3 __attribute__((const, overloadable))
658 cbrt(float3 v);
659
660extern float4 __attribute__((const, overloadable))
661 cbrt(float4 v);
662
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800663#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800664extern half __attribute__((const, overloadable))
665 cbrt(half v);
666#endif
667
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800668#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800669extern half2 __attribute__((const, overloadable))
670 cbrt(half2 v);
671#endif
672
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800673#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800674extern half3 __attribute__((const, overloadable))
675 cbrt(half3 v);
676#endif
677
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800678#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800679extern half4 __attribute__((const, overloadable))
680 cbrt(half4 v);
681#endif
682
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700683/*
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 */
692extern float __attribute__((const, overloadable))
693 ceil(float v);
694
695extern float2 __attribute__((const, overloadable))
696 ceil(float2 v);
697
698extern float3 __attribute__((const, overloadable))
699 ceil(float3 v);
700
701extern float4 __attribute__((const, overloadable))
702 ceil(float4 v);
703
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800704#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800705extern half __attribute__((const, overloadable))
706 ceil(half v);
707#endif
708
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800709#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800710extern half2 __attribute__((const, overloadable))
711 ceil(half2 v);
712#endif
713
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800714#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800715extern half3 __attribute__((const, overloadable))
716 ceil(half3 v);
717#endif
718
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -0800719#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -0800720extern half4 __attribute__((const, overloadable))
721 ceil(half4 v);
722#endif
723
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700724/*
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 Brouillet4a730042015-04-02 16:15:25 -0700736 * 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 Brouilletbe216382015-03-22 12:44:27 -0700739 */
740extern float __attribute__((const, overloadable))
741 clamp(float value, float min_value, float max_value);
742
743extern float2 __attribute__((const, overloadable))
744 clamp(float2 value, float2 min_value, float2 max_value);
745
746extern float3 __attribute__((const, overloadable))
747 clamp(float3 value, float3 min_value, float3 max_value);
748
749extern float4 __attribute__((const, overloadable))
750 clamp(float4 value, float4 min_value, float4 max_value);
751
752extern float2 __attribute__((const, overloadable))
753 clamp(float2 value, float min_value, float max_value);
754
755extern float3 __attribute__((const, overloadable))
756 clamp(float3 value, float min_value, float max_value);
757
758extern float4 __attribute__((const, overloadable))
759 clamp(float4 value, float min_value, float max_value);
760
761#if (defined(RS_VERSION) && (RS_VERSION >= 19))
762extern 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))
767extern 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))
772extern 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))
777extern 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))
782extern 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))
787extern 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))
792extern 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))
797extern 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))
802extern 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))
807extern 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))
812extern 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))
817extern 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))
822extern 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))
827extern 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))
832extern 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))
837extern 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))
842extern 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))
847extern 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))
852extern 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))
857extern 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))
862extern 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))
867extern 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))
872extern 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))
877extern 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))
882extern 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))
887extern 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))
892extern 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))
897extern 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))
902extern 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))
907extern 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))
912extern 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))
917extern 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))
922extern 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))
927extern 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))
932extern 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))
937extern 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))
942extern 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))
947extern 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))
952extern 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))
957extern 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))
962extern 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))
967extern 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))
972extern 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))
977extern 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))
982extern 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))
987extern 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))
992extern 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))
997extern 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))
1002extern 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))
1007extern 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))
1012extern 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))
1017extern 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))
1022extern 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))
1027extern 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))
1032extern 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))
1037extern ulong4 __attribute__((const, overloadable))
1038 clamp(ulong4 value, ulong min_value, ulong max_value);
1039#endif
1040
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001041#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001042extern half __attribute__((const, overloadable))
1043 clamp(half value, half min_value, half max_value);
1044#endif
1045
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001046#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001047extern half2 __attribute__((const, overloadable))
1048 clamp(half2 value, half2 min_value, half2 max_value);
1049#endif
1050
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001051#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001052extern half3 __attribute__((const, overloadable))
1053 clamp(half3 value, half3 min_value, half3 max_value);
1054#endif
1055
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001056#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001057extern half4 __attribute__((const, overloadable))
1058 clamp(half4 value, half4 min_value, half4 max_value);
1059#endif
1060
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001061#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001062extern half2 __attribute__((const, overloadable))
1063 clamp(half2 value, half min_value, half max_value);
1064#endif
1065
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001066#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001067extern half3 __attribute__((const, overloadable))
1068 clamp(half3 value, half min_value, half max_value);
1069#endif
1070
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001071#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001072extern half4 __attribute__((const, overloadable))
1073 clamp(half4 value, half min_value, half max_value);
1074#endif
1075
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001076/*
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 */
1083extern char __attribute__((const, overloadable))
1084 clz(char value);
1085
1086extern char2 __attribute__((const, overloadable))
1087 clz(char2 value);
1088
1089extern char3 __attribute__((const, overloadable))
1090 clz(char3 value);
1091
1092extern char4 __attribute__((const, overloadable))
1093 clz(char4 value);
1094
1095extern uchar __attribute__((const, overloadable))
1096 clz(uchar value);
1097
1098extern uchar2 __attribute__((const, overloadable))
1099 clz(uchar2 value);
1100
1101extern uchar3 __attribute__((const, overloadable))
1102 clz(uchar3 value);
1103
1104extern uchar4 __attribute__((const, overloadable))
1105 clz(uchar4 value);
1106
1107extern short __attribute__((const, overloadable))
1108 clz(short value);
1109
1110extern short2 __attribute__((const, overloadable))
1111 clz(short2 value);
1112
1113extern short3 __attribute__((const, overloadable))
1114 clz(short3 value);
1115
1116extern short4 __attribute__((const, overloadable))
1117 clz(short4 value);
1118
1119extern ushort __attribute__((const, overloadable))
1120 clz(ushort value);
1121
1122extern ushort2 __attribute__((const, overloadable))
1123 clz(ushort2 value);
1124
1125extern ushort3 __attribute__((const, overloadable))
1126 clz(ushort3 value);
1127
1128extern ushort4 __attribute__((const, overloadable))
1129 clz(ushort4 value);
1130
1131extern int __attribute__((const, overloadable))
1132 clz(int value);
1133
1134extern int2 __attribute__((const, overloadable))
1135 clz(int2 value);
1136
1137extern int3 __attribute__((const, overloadable))
1138 clz(int3 value);
1139
1140extern int4 __attribute__((const, overloadable))
1141 clz(int4 value);
1142
1143extern uint __attribute__((const, overloadable))
1144 clz(uint value);
1145
1146extern uint2 __attribute__((const, overloadable))
1147 clz(uint2 value);
1148
1149extern uint3 __attribute__((const, overloadable))
1150 clz(uint3 value);
1151
1152extern 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 */
1164extern float __attribute__((const, overloadable))
1165 copysign(float magnitude_value, float sign_value);
1166
1167extern float2 __attribute__((const, overloadable))
1168 copysign(float2 magnitude_value, float2 sign_value);
1169
1170extern float3 __attribute__((const, overloadable))
1171 copysign(float3 magnitude_value, float3 sign_value);
1172
1173extern float4 __attribute__((const, overloadable))
1174 copysign(float4 magnitude_value, float4 sign_value);
1175
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001176#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08001177extern half __attribute__((const, overloadable))
1178 copysign(half magnitude_value, half sign_value);
1179#endif
1180
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001181#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08001182extern half2 __attribute__((const, overloadable))
1183 copysign(half2 magnitude_value, half2 sign_value);
1184#endif
1185
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001186#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08001187extern half3 __attribute__((const, overloadable))
1188 copysign(half3 magnitude_value, half3 sign_value);
1189#endif
1190
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001191#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08001192extern half4 __attribute__((const, overloadable))
1193 copysign(half4 magnitude_value, half4 sign_value);
1194#endif
1195
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001196/*
1197 * cos: Cosine
1198 *
1199 * Returns the cosine of an angle measured in radians.
1200 *
1201 * See also native_cos().
1202 */
1203extern float __attribute__((const, overloadable))
1204 cos(float v);
1205
1206extern float2 __attribute__((const, overloadable))
1207 cos(float2 v);
1208
1209extern float3 __attribute__((const, overloadable))
1210 cos(float3 v);
1211
1212extern float4 __attribute__((const, overloadable))
1213 cos(float4 v);
1214
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001215#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001216extern half __attribute__((const, overloadable))
1217 cos(half v);
1218#endif
1219
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001220#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001221extern half2 __attribute__((const, overloadable))
1222 cos(half2 v);
1223#endif
1224
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001225#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001226extern half3 __attribute__((const, overloadable))
1227 cos(half3 v);
1228#endif
1229
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001230#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001231extern half4 __attribute__((const, overloadable))
1232 cos(half4 v);
1233#endif
1234
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001235/*
1236 * cosh: Hypebolic cosine
1237 *
1238 * Returns the hypebolic cosine of v, where v is measured in radians.
1239 *
1240 * See also native_cosh().
1241 */
1242extern float __attribute__((const, overloadable))
1243 cosh(float v);
1244
1245extern float2 __attribute__((const, overloadable))
1246 cosh(float2 v);
1247
1248extern float3 __attribute__((const, overloadable))
1249 cosh(float3 v);
1250
1251extern float4 __attribute__((const, overloadable))
1252 cosh(float4 v);
1253
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001254#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001255extern half __attribute__((const, overloadable))
1256 cosh(half v);
1257#endif
1258
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001259#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001260extern half2 __attribute__((const, overloadable))
1261 cosh(half2 v);
1262#endif
1263
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001264#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001265extern half3 __attribute__((const, overloadable))
1266 cosh(half3 v);
1267#endif
1268
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001269#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001270extern half4 __attribute__((const, overloadable))
1271 cosh(half4 v);
1272#endif
1273
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001274/*
1275 * cospi: Cosine of a number multiplied by pi
1276 *
1277 * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
1278 *
1279 * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
1280 *
1281 * See also native_cospi().
1282 */
1283extern float __attribute__((const, overloadable))
1284 cospi(float v);
1285
1286extern float2 __attribute__((const, overloadable))
1287 cospi(float2 v);
1288
1289extern float3 __attribute__((const, overloadable))
1290 cospi(float3 v);
1291
1292extern float4 __attribute__((const, overloadable))
1293 cospi(float4 v);
1294
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001295#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001296extern half __attribute__((const, overloadable))
1297 cospi(half v);
1298#endif
1299
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001300#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001301extern half2 __attribute__((const, overloadable))
1302 cospi(half2 v);
1303#endif
1304
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001305#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001306extern half3 __attribute__((const, overloadable))
1307 cospi(half3 v);
1308#endif
1309
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001310#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001311extern half4 __attribute__((const, overloadable))
1312 cospi(half4 v);
1313#endif
1314
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001315/*
1316 * degrees: Converts radians into degrees
1317 *
1318 * Converts from radians to degrees.
1319 */
1320extern float __attribute__((const, overloadable))
1321 degrees(float v);
1322
1323extern float2 __attribute__((const, overloadable))
1324 degrees(float2 v);
1325
1326extern float3 __attribute__((const, overloadable))
1327 degrees(float3 v);
1328
1329extern float4 __attribute__((const, overloadable))
1330 degrees(float4 v);
1331
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001332#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001333extern half __attribute__((const, overloadable))
1334 degrees(half v);
1335#endif
1336
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001337#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001338extern half2 __attribute__((const, overloadable))
1339 degrees(half2 v);
1340#endif
1341
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001342#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001343extern half3 __attribute__((const, overloadable))
1344 degrees(half3 v);
1345#endif
1346
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001347#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001348extern half4 __attribute__((const, overloadable))
1349 degrees(half4 v);
1350#endif
1351
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001352/*
1353 * erf: Mathematical error function
1354 *
1355 * Returns the error function.
1356 */
1357extern float __attribute__((const, overloadable))
1358 erf(float v);
1359
1360extern float2 __attribute__((const, overloadable))
1361 erf(float2 v);
1362
1363extern float3 __attribute__((const, overloadable))
1364 erf(float3 v);
1365
1366extern float4 __attribute__((const, overloadable))
1367 erf(float4 v);
1368
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001369#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001370extern half __attribute__((const, overloadable))
1371 erf(half v);
1372#endif
1373
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001374#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001375extern half2 __attribute__((const, overloadable))
1376 erf(half2 v);
1377#endif
1378
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001379#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001380extern half3 __attribute__((const, overloadable))
1381 erf(half3 v);
1382#endif
1383
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001384#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001385extern half4 __attribute__((const, overloadable))
1386 erf(half4 v);
1387#endif
1388
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001389/*
1390 * erfc: Mathematical complementary error function
1391 *
1392 * Returns the complementary error function.
1393 */
1394extern float __attribute__((const, overloadable))
1395 erfc(float v);
1396
1397extern float2 __attribute__((const, overloadable))
1398 erfc(float2 v);
1399
1400extern float3 __attribute__((const, overloadable))
1401 erfc(float3 v);
1402
1403extern float4 __attribute__((const, overloadable))
1404 erfc(float4 v);
1405
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001406#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001407extern half __attribute__((const, overloadable))
1408 erfc(half v);
1409#endif
1410
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001411#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001412extern half2 __attribute__((const, overloadable))
1413 erfc(half2 v);
1414#endif
1415
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001416#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001417extern half3 __attribute__((const, overloadable))
1418 erfc(half3 v);
1419#endif
1420
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001421#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001422extern half4 __attribute__((const, overloadable))
1423 erfc(half4 v);
1424#endif
1425
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001426/*
1427 * exp: e raised to a number
1428 *
1429 * Returns e raised to v, i.e. e ^ v.
1430 *
1431 * See also native_exp().
1432 */
1433extern float __attribute__((const, overloadable))
1434 exp(float v);
1435
1436extern float2 __attribute__((const, overloadable))
1437 exp(float2 v);
1438
1439extern float3 __attribute__((const, overloadable))
1440 exp(float3 v);
1441
1442extern float4 __attribute__((const, overloadable))
1443 exp(float4 v);
1444
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001445#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001446extern half __attribute__((const, overloadable))
1447 exp(half v);
1448#endif
1449
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001450#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001451extern half2 __attribute__((const, overloadable))
1452 exp(half2 v);
1453#endif
1454
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001455#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001456extern half3 __attribute__((const, overloadable))
1457 exp(half3 v);
1458#endif
1459
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001460#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001461extern half4 __attribute__((const, overloadable))
1462 exp(half4 v);
1463#endif
1464
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001465/*
1466 * exp10: 10 raised to a number
1467 *
1468 * Returns 10 raised to v, i.e. 10.f ^ v.
1469 *
1470 * See also native_exp10().
1471 */
1472extern float __attribute__((const, overloadable))
1473 exp10(float v);
1474
1475extern float2 __attribute__((const, overloadable))
1476 exp10(float2 v);
1477
1478extern float3 __attribute__((const, overloadable))
1479 exp10(float3 v);
1480
1481extern float4 __attribute__((const, overloadable))
1482 exp10(float4 v);
1483
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001484#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001485extern half __attribute__((const, overloadable))
1486 exp10(half v);
1487#endif
1488
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001489#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001490extern half2 __attribute__((const, overloadable))
1491 exp10(half2 v);
1492#endif
1493
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001494#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001495extern half3 __attribute__((const, overloadable))
1496 exp10(half3 v);
1497#endif
1498
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001499#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001500extern half4 __attribute__((const, overloadable))
1501 exp10(half4 v);
1502#endif
1503
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001504/*
1505 * exp2: 2 raised to a number
1506 *
1507 * Returns 2 raised to v, i.e. 2.f ^ v.
1508 *
1509 * See also native_exp2().
1510 */
1511extern float __attribute__((const, overloadable))
1512 exp2(float v);
1513
1514extern float2 __attribute__((const, overloadable))
1515 exp2(float2 v);
1516
1517extern float3 __attribute__((const, overloadable))
1518 exp2(float3 v);
1519
1520extern float4 __attribute__((const, overloadable))
1521 exp2(float4 v);
1522
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001523#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001524extern half __attribute__((const, overloadable))
1525 exp2(half v);
1526#endif
1527
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001528#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001529extern half2 __attribute__((const, overloadable))
1530 exp2(half2 v);
1531#endif
1532
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001533#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001534extern half3 __attribute__((const, overloadable))
1535 exp2(half3 v);
1536#endif
1537
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001538#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001539extern half4 __attribute__((const, overloadable))
1540 exp2(half4 v);
1541#endif
1542
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001543/*
1544 * expm1: e raised to a number minus one
1545 *
1546 * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
1547 *
1548 * See also native_expm1().
1549 */
1550extern float __attribute__((const, overloadable))
1551 expm1(float v);
1552
1553extern float2 __attribute__((const, overloadable))
1554 expm1(float2 v);
1555
1556extern float3 __attribute__((const, overloadable))
1557 expm1(float3 v);
1558
1559extern float4 __attribute__((const, overloadable))
1560 expm1(float4 v);
1561
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001562#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001563extern half __attribute__((const, overloadable))
1564 expm1(half v);
1565#endif
1566
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001567#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001568extern half2 __attribute__((const, overloadable))
1569 expm1(half2 v);
1570#endif
1571
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001572#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001573extern half3 __attribute__((const, overloadable))
1574 expm1(half3 v);
1575#endif
1576
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001577#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001578extern half4 __attribute__((const, overloadable))
1579 expm1(half4 v);
1580#endif
1581
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001582/*
1583 * fabs: Absolute value of a float
1584 *
1585 * Returns the absolute value of the float v.
1586 *
1587 * For integers, use abs().
1588 */
1589extern float __attribute__((const, overloadable))
1590 fabs(float v);
1591
1592extern float2 __attribute__((const, overloadable))
1593 fabs(float2 v);
1594
1595extern float3 __attribute__((const, overloadable))
1596 fabs(float3 v);
1597
1598extern float4 __attribute__((const, overloadable))
1599 fabs(float4 v);
1600
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001601#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001602extern half __attribute__((const, overloadable))
1603 fabs(half v);
1604#endif
1605
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001606#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001607extern half2 __attribute__((const, overloadable))
1608 fabs(half2 v);
1609#endif
1610
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001611#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001612extern half3 __attribute__((const, overloadable))
1613 fabs(half3 v);
1614#endif
1615
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001616#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001617extern half4 __attribute__((const, overloadable))
1618 fabs(half4 v);
1619#endif
1620
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001621/*
1622 * fdim: Positive difference between two values
1623 *
1624 * Returns the positive difference between two values.
1625 *
1626 * If a > b, returns (a - b) otherwise returns 0f.
1627 */
1628extern float __attribute__((const, overloadable))
1629 fdim(float a, float b);
1630
1631extern float2 __attribute__((const, overloadable))
1632 fdim(float2 a, float2 b);
1633
1634extern float3 __attribute__((const, overloadable))
1635 fdim(float3 a, float3 b);
1636
1637extern float4 __attribute__((const, overloadable))
1638 fdim(float4 a, float4 b);
1639
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001640#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001641extern half __attribute__((const, overloadable))
1642 fdim(half a, half b);
1643#endif
1644
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001645#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001646extern half2 __attribute__((const, overloadable))
1647 fdim(half2 a, half2 b);
1648#endif
1649
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001650#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001651extern half3 __attribute__((const, overloadable))
1652 fdim(half3 a, half3 b);
1653#endif
1654
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001655#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001656extern half4 __attribute__((const, overloadable))
1657 fdim(half4 a, half4 b);
1658#endif
1659
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001660/*
1661 * floor: Smallest integer not greater than a value
1662 *
1663 * Returns the smallest integer not greater than a value.
1664 *
1665 * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f.
1666 *
1667 * See also ceil().
1668 */
1669extern float __attribute__((const, overloadable))
1670 floor(float v);
1671
1672extern float2 __attribute__((const, overloadable))
1673 floor(float2 v);
1674
1675extern float3 __attribute__((const, overloadable))
1676 floor(float3 v);
1677
1678extern float4 __attribute__((const, overloadable))
1679 floor(float4 v);
1680
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001681#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001682extern half __attribute__((const, overloadable))
1683 floor(half v);
1684#endif
1685
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001686#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001687extern half2 __attribute__((const, overloadable))
1688 floor(half2 v);
1689#endif
1690
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001691#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001692extern half3 __attribute__((const, overloadable))
1693 floor(half3 v);
1694#endif
1695
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001696#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001697extern half4 __attribute__((const, overloadable))
1698 floor(half4 v);
1699#endif
1700
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001701/*
1702 * fma: Multiply and add
1703 *
1704 * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
1705 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001706 * This function is similar to mad(). fma() retains full precision of the multiplied result
1707 * and rounds only after the addition. mad() rounds after the multiplication and the addition.
1708 * This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001709 */
1710extern float __attribute__((const, overloadable))
1711 fma(float multiplicand1, float multiplicand2, float offset);
1712
1713extern float2 __attribute__((const, overloadable))
1714 fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
1715
1716extern float3 __attribute__((const, overloadable))
1717 fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
1718
1719extern float4 __attribute__((const, overloadable))
1720 fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
1721
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001722#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001723extern half __attribute__((const, overloadable))
1724 fma(half multiplicand1, half multiplicand2, half offset);
1725#endif
1726
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001727#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001728extern half2 __attribute__((const, overloadable))
1729 fma(half2 multiplicand1, half2 multiplicand2, half2 offset);
1730#endif
1731
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001732#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001733extern half3 __attribute__((const, overloadable))
1734 fma(half3 multiplicand1, half3 multiplicand2, half3 offset);
1735#endif
1736
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001737#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001738extern half4 __attribute__((const, overloadable))
1739 fma(half4 multiplicand1, half4 multiplicand2, half4 offset);
1740#endif
1741
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001742/*
1743 * fmax: Maximum of two floats
1744 *
1745 * Returns the maximum of a and b, i.e. (a < b ? b : a).
1746 *
1747 * The max() function returns identical results but can be applied to more data types.
1748 */
1749extern float __attribute__((const, overloadable))
1750 fmax(float a, float b);
1751
1752extern float2 __attribute__((const, overloadable))
1753 fmax(float2 a, float2 b);
1754
1755extern float3 __attribute__((const, overloadable))
1756 fmax(float3 a, float3 b);
1757
1758extern float4 __attribute__((const, overloadable))
1759 fmax(float4 a, float4 b);
1760
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001761#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001762extern half __attribute__((const, overloadable))
1763 fmax(half a, half b);
1764#endif
1765
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001766#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001767extern half2 __attribute__((const, overloadable))
1768 fmax(half2 a, half2 b);
1769#endif
1770
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001771#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001772extern half3 __attribute__((const, overloadable))
1773 fmax(half3 a, half3 b);
1774#endif
1775
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001776#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001777extern half4 __attribute__((const, overloadable))
1778 fmax(half4 a, half4 b);
1779#endif
1780
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001781extern float2 __attribute__((const, overloadable))
1782 fmax(float2 a, float b);
1783
1784extern float3 __attribute__((const, overloadable))
1785 fmax(float3 a, float b);
1786
1787extern float4 __attribute__((const, overloadable))
1788 fmax(float4 a, float b);
1789
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001790#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001791extern half2 __attribute__((const, overloadable))
1792 fmax(half2 a, half b);
1793#endif
1794
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001795#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001796extern half3 __attribute__((const, overloadable))
1797 fmax(half3 a, half b);
1798#endif
1799
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001800#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001801extern half4 __attribute__((const, overloadable))
1802 fmax(half4 a, half b);
1803#endif
1804
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001805/*
1806 * fmin: Minimum of two floats
1807 *
1808 * Returns the minimum of a and b, i.e. (a > b ? b : a).
1809 *
1810 * The min() function returns identical results but can be applied to more data types.
1811 */
1812extern float __attribute__((const, overloadable))
1813 fmin(float a, float b);
1814
1815extern float2 __attribute__((const, overloadable))
1816 fmin(float2 a, float2 b);
1817
1818extern float3 __attribute__((const, overloadable))
1819 fmin(float3 a, float3 b);
1820
1821extern float4 __attribute__((const, overloadable))
1822 fmin(float4 a, float4 b);
1823
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001824#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001825extern half __attribute__((const, overloadable))
1826 fmin(half a, half b);
1827#endif
1828
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001829#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001830extern half2 __attribute__((const, overloadable))
1831 fmin(half2 a, half2 b);
1832#endif
1833
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001834#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001835extern half3 __attribute__((const, overloadable))
1836 fmin(half3 a, half3 b);
1837#endif
1838
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001839#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001840extern half4 __attribute__((const, overloadable))
1841 fmin(half4 a, half4 b);
1842#endif
1843
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001844extern float2 __attribute__((const, overloadable))
1845 fmin(float2 a, float b);
1846
1847extern float3 __attribute__((const, overloadable))
1848 fmin(float3 a, float b);
1849
1850extern float4 __attribute__((const, overloadable))
1851 fmin(float4 a, float b);
1852
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001853#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001854extern half2 __attribute__((const, overloadable))
1855 fmin(half2 a, half b);
1856#endif
1857
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001858#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001859extern half3 __attribute__((const, overloadable))
1860 fmin(half3 a, half b);
1861#endif
1862
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001863#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001864extern half4 __attribute__((const, overloadable))
1865 fmin(half4 a, half b);
1866#endif
1867
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001868/*
1869 * fmod: Modulo
1870 *
1871 * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1872 *
1873 * The function remainder() is similar but rounds toward the closest interger.
1874 * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
1875 * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
1876 */
1877extern float __attribute__((const, overloadable))
1878 fmod(float numerator, float denominator);
1879
1880extern float2 __attribute__((const, overloadable))
1881 fmod(float2 numerator, float2 denominator);
1882
1883extern float3 __attribute__((const, overloadable))
1884 fmod(float3 numerator, float3 denominator);
1885
1886extern float4 __attribute__((const, overloadable))
1887 fmod(float4 numerator, float4 denominator);
1888
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001889#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001890extern half __attribute__((const, overloadable))
1891 fmod(half numerator, half denominator);
1892#endif
1893
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001894#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001895extern half2 __attribute__((const, overloadable))
1896 fmod(half2 numerator, half2 denominator);
1897#endif
1898
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001899#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001900extern half3 __attribute__((const, overloadable))
1901 fmod(half3 numerator, half3 denominator);
1902#endif
1903
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001904#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001905extern half4 __attribute__((const, overloadable))
1906 fmod(half4 numerator, half4 denominator);
1907#endif
1908
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001909/*
1910 * fract: Positive fractional part
1911 *
1912 * Returns the positive fractional part of v, i.e. v - floor(v).
1913 *
1914 * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
1915 * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
1916 *
1917 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07001918 * v: Input value.
1919 * floor: If floor is not null, *floor will be set to the floor of v.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001920 */
1921extern float __attribute__((overloadable))
1922 fract(float v, float* floor);
1923
1924extern float2 __attribute__((overloadable))
1925 fract(float2 v, float2* floor);
1926
1927extern float3 __attribute__((overloadable))
1928 fract(float3 v, float3* floor);
1929
1930extern float4 __attribute__((overloadable))
1931 fract(float4 v, float4* floor);
1932
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001933#if !defined(RS_VERSION) || (RS_VERSION <= 23)
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001934static inline float __attribute__((const, overloadable))
1935 fract(float v) {
1936 float unused;
1937 return fract(v, &unused);
1938}
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001939#endif
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001940
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001941#if !defined(RS_VERSION) || (RS_VERSION <= 23)
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001942static inline float2 __attribute__((const, overloadable))
1943 fract(float2 v) {
1944 float2 unused;
1945 return fract(v, &unused);
1946}
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001947#endif
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001948
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001949#if !defined(RS_VERSION) || (RS_VERSION <= 23)
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001950static inline float3 __attribute__((const, overloadable))
1951 fract(float3 v) {
1952 float3 unused;
1953 return fract(v, &unused);
1954}
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001955#endif
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001956
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001957#if !defined(RS_VERSION) || (RS_VERSION <= 23)
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001958static inline float4 __attribute__((const, overloadable))
1959 fract(float4 v) {
1960 float4 unused;
1961 return fract(v, &unused);
1962}
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001963#endif
1964
1965#if (defined(RS_VERSION) && (RS_VERSION >= 24))
1966extern float __attribute__((overloadable))
1967 fract(float v);
1968#endif
1969
1970#if (defined(RS_VERSION) && (RS_VERSION >= 24))
1971extern float2 __attribute__((overloadable))
1972 fract(float2 v);
1973#endif
1974
1975#if (defined(RS_VERSION) && (RS_VERSION >= 24))
1976extern float3 __attribute__((overloadable))
1977 fract(float3 v);
1978#endif
1979
1980#if (defined(RS_VERSION) && (RS_VERSION >= 24))
1981extern float4 __attribute__((overloadable))
1982 fract(float4 v);
1983#endif
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001984
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001985#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08001986extern half __attribute__((overloadable))
1987 fract(half v, half* floor);
1988#endif
1989
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001990#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08001991extern half2 __attribute__((overloadable))
1992 fract(half2 v, half2* floor);
1993#endif
1994
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08001995#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08001996extern half3 __attribute__((overloadable))
1997 fract(half3 v, half3* floor);
1998#endif
1999
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002000#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002001extern half4 __attribute__((overloadable))
2002 fract(half4 v, half4* floor);
2003#endif
2004
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002005#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002006extern half __attribute__((overloadable))
2007 fract(half v);
2008#endif
2009
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002010#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002011extern half2 __attribute__((overloadable))
2012 fract(half2 v);
2013#endif
2014
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002015#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002016extern half3 __attribute__((overloadable))
2017 fract(half3 v);
2018#endif
2019
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002020#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002021extern half4 __attribute__((overloadable))
2022 fract(half4 v);
2023#endif
2024
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002025/*
2026 * frexp: Binary mantissa and exponent
2027 *
2028 * Returns the binary mantissa and exponent of v, i.e. v == mantissa * 2 ^ exponent.
2029 *
2030 * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
2031 *
2032 * See ldexp() for the reverse operation. See also logb() and ilogb().
2033 *
2034 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07002035 * v: Input value.
2036 * exponent: If exponent is not null, *exponent will be set to the exponent of v.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002037 */
2038extern float __attribute__((overloadable))
2039 frexp(float v, int* exponent);
2040
2041extern float2 __attribute__((overloadable))
2042 frexp(float2 v, int2* exponent);
2043
2044extern float3 __attribute__((overloadable))
2045 frexp(float3 v, int3* exponent);
2046
2047extern float4 __attribute__((overloadable))
2048 frexp(float4 v, int4* exponent);
2049
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002050#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002051extern half __attribute__((overloadable))
2052 frexp(half v, int* exponent);
2053#endif
2054
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002055#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002056extern half2 __attribute__((overloadable))
2057 frexp(half2 v, int2* exponent);
2058#endif
2059
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002060#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002061extern half3 __attribute__((overloadable))
2062 frexp(half3 v, int3* exponent);
2063#endif
2064
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002065#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08002066extern half4 __attribute__((overloadable))
2067 frexp(half4 v, int4* exponent);
2068#endif
2069
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002070/*
2071 * half_recip: Reciprocal computed to 16 bit precision
2072 *
2073 * Returns the approximate reciprocal of a value.
2074 *
2075 * The precision is that of a 16 bit floating point value.
2076 *
2077 * See also native_recip().
2078 */
2079#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2080extern float __attribute__((const, overloadable))
2081 half_recip(float v);
2082#endif
2083
2084#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2085extern float2 __attribute__((const, overloadable))
2086 half_recip(float2 v);
2087#endif
2088
2089#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2090extern float3 __attribute__((const, overloadable))
2091 half_recip(float3 v);
2092#endif
2093
2094#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2095extern float4 __attribute__((const, overloadable))
2096 half_recip(float4 v);
2097#endif
2098
2099/*
2100 * half_rsqrt: Reciprocal of a square root computed to 16 bit precision
2101 *
2102 * Returns the approximate value of (1.f / sqrt(value)).
2103 *
2104 * The precision is that of a 16 bit floating point value.
2105 *
2106 * See also rsqrt(), native_rsqrt().
2107 */
2108#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2109extern float __attribute__((const, overloadable))
2110 half_rsqrt(float v);
2111#endif
2112
2113#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2114extern float2 __attribute__((const, overloadable))
2115 half_rsqrt(float2 v);
2116#endif
2117
2118#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2119extern float3 __attribute__((const, overloadable))
2120 half_rsqrt(float3 v);
2121#endif
2122
2123#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2124extern float4 __attribute__((const, overloadable))
2125 half_rsqrt(float4 v);
2126#endif
2127
2128/*
2129 * half_sqrt: Square root computed to 16 bit precision
2130 *
2131 * Returns the approximate square root of a value.
2132 *
2133 * The precision is that of a 16 bit floating point value.
2134 *
2135 * See also sqrt(), native_sqrt().
2136 */
2137#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2138extern float __attribute__((const, overloadable))
2139 half_sqrt(float v);
2140#endif
2141
2142#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2143extern float2 __attribute__((const, overloadable))
2144 half_sqrt(float2 v);
2145#endif
2146
2147#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2148extern float3 __attribute__((const, overloadable))
2149 half_sqrt(float3 v);
2150#endif
2151
2152#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2153extern float4 __attribute__((const, overloadable))
2154 half_sqrt(float4 v);
2155#endif
2156
2157/*
2158 * hypot: Hypotenuse
2159 *
2160 * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
2161 *
2162 * See also native_hypot().
2163 */
2164extern float __attribute__((const, overloadable))
2165 hypot(float a, float b);
2166
2167extern float2 __attribute__((const, overloadable))
2168 hypot(float2 a, float2 b);
2169
2170extern float3 __attribute__((const, overloadable))
2171 hypot(float3 a, float3 b);
2172
2173extern float4 __attribute__((const, overloadable))
2174 hypot(float4 a, float4 b);
2175
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002176#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002177extern half __attribute__((const, overloadable))
2178 hypot(half a, half b);
2179#endif
2180
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002181#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002182extern half2 __attribute__((const, overloadable))
2183 hypot(half2 a, half2 b);
2184#endif
2185
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002186#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002187extern half3 __attribute__((const, overloadable))
2188 hypot(half3 a, half3 b);
2189#endif
2190
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002191#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002192extern half4 __attribute__((const, overloadable))
2193 hypot(half4 a, half4 b);
2194#endif
2195
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002196/*
2197 * ilogb: Base two exponent
2198 *
2199 * Returns the base two exponent of a value, where the mantissa is between
2200 * 1.f (inclusive) and 2.f (exclusive).
2201 *
2202 * For example, ilogb(8.5f) returns 3.
2203 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002204 * Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002205 *
2206 * logb() is similar but returns a float.
2207 */
2208extern int __attribute__((const, overloadable))
2209 ilogb(float v);
2210
2211extern int2 __attribute__((const, overloadable))
2212 ilogb(float2 v);
2213
2214extern int3 __attribute__((const, overloadable))
2215 ilogb(float3 v);
2216
2217extern int4 __attribute__((const, overloadable))
2218 ilogb(float4 v);
2219
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002220#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08002221extern int __attribute__((const, overloadable))
2222 ilogb(half v);
2223#endif
2224
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002225#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08002226extern int2 __attribute__((const, overloadable))
2227 ilogb(half2 v);
2228#endif
2229
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002230#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08002231extern int3 __attribute__((const, overloadable))
2232 ilogb(half3 v);
2233#endif
2234
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002235#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08002236extern int4 __attribute__((const, overloadable))
2237 ilogb(half4 v);
2238#endif
2239
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002240/*
2241 * ldexp: Creates a floating point from mantissa and exponent
2242 *
2243 * Returns the floating point created from the mantissa and exponent,
2244 * i.e. (mantissa * 2 ^ exponent).
2245 *
2246 * See frexp() for the reverse operation.
2247 *
2248 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002249 * mantissa: Mantissa.
2250 * exponent: Exponent, a single component or matching vector.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002251 */
2252extern float __attribute__((const, overloadable))
2253 ldexp(float mantissa, int exponent);
2254
2255extern float2 __attribute__((const, overloadable))
2256 ldexp(float2 mantissa, int2 exponent);
2257
2258extern float3 __attribute__((const, overloadable))
2259 ldexp(float3 mantissa, int3 exponent);
2260
2261extern float4 __attribute__((const, overloadable))
2262 ldexp(float4 mantissa, int4 exponent);
2263
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002264#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002265extern half __attribute__((const, overloadable))
2266 ldexp(half mantissa, int exponent);
2267#endif
2268
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002269#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002270extern half2 __attribute__((const, overloadable))
2271 ldexp(half2 mantissa, int2 exponent);
2272#endif
2273
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002274#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002275extern half3 __attribute__((const, overloadable))
2276 ldexp(half3 mantissa, int3 exponent);
2277#endif
2278
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002279#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002280extern half4 __attribute__((const, overloadable))
2281 ldexp(half4 mantissa, int4 exponent);
2282#endif
2283
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002284extern float2 __attribute__((const, overloadable))
2285 ldexp(float2 mantissa, int exponent);
2286
2287extern float3 __attribute__((const, overloadable))
2288 ldexp(float3 mantissa, int exponent);
2289
2290extern float4 __attribute__((const, overloadable))
2291 ldexp(float4 mantissa, int exponent);
2292
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002293#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002294extern half2 __attribute__((const, overloadable))
2295 ldexp(half2 mantissa, int exponent);
2296#endif
2297
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002298#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002299extern half3 __attribute__((const, overloadable))
2300 ldexp(half3 mantissa, int exponent);
2301#endif
2302
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002303#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002304extern half4 __attribute__((const, overloadable))
2305 ldexp(half4 mantissa, int exponent);
2306#endif
2307
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002308/*
2309 * lgamma: Natural logarithm of the gamma function
2310 *
2311 * Returns the natural logarithm of the absolute value of the gamma function,
2312 * i.e. log(fabs(tgamma(v))).
2313 *
2314 * See also tgamma().
2315 *
2316 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07002317 * 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 Brouilletbe216382015-03-22 12:44:27 -07002318 */
2319extern float __attribute__((const, overloadable))
2320 lgamma(float v);
2321
2322extern float2 __attribute__((const, overloadable))
2323 lgamma(float2 v);
2324
2325extern float3 __attribute__((const, overloadable))
2326 lgamma(float3 v);
2327
2328extern float4 __attribute__((const, overloadable))
2329 lgamma(float4 v);
2330
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002331#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002332extern half __attribute__((const, overloadable))
2333 lgamma(half v);
2334#endif
2335
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002336#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002337extern half2 __attribute__((const, overloadable))
2338 lgamma(half2 v);
2339#endif
2340
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002341#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002342extern half3 __attribute__((const, overloadable))
2343 lgamma(half3 v);
2344#endif
2345
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002346#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002347extern half4 __attribute__((const, overloadable))
2348 lgamma(half4 v);
2349#endif
2350
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002351extern float __attribute__((overloadable))
2352 lgamma(float v, int* sign_of_gamma);
2353
2354extern float2 __attribute__((overloadable))
2355 lgamma(float2 v, int2* sign_of_gamma);
2356
2357extern float3 __attribute__((overloadable))
2358 lgamma(float3 v, int3* sign_of_gamma);
2359
2360extern float4 __attribute__((overloadable))
2361 lgamma(float4 v, int4* sign_of_gamma);
2362
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002363#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002364extern half __attribute__((overloadable))
2365 lgamma(half v, int* sign_of_gamma);
2366#endif
2367
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002368#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002369extern half2 __attribute__((overloadable))
2370 lgamma(half2 v, int2* sign_of_gamma);
2371#endif
2372
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002373#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002374extern half3 __attribute__((overloadable))
2375 lgamma(half3 v, int3* sign_of_gamma);
2376#endif
2377
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002378#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002379extern half4 __attribute__((overloadable))
2380 lgamma(half4 v, int4* sign_of_gamma);
2381#endif
2382
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002383/*
2384 * log: Natural logarithm
2385 *
2386 * Returns the natural logarithm.
2387 *
2388 * See also native_log().
2389 */
2390extern float __attribute__((const, overloadable))
2391 log(float v);
2392
2393extern float2 __attribute__((const, overloadable))
2394 log(float2 v);
2395
2396extern float3 __attribute__((const, overloadable))
2397 log(float3 v);
2398
2399extern float4 __attribute__((const, overloadable))
2400 log(float4 v);
2401
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002402#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002403extern half __attribute__((const, overloadable))
2404 log(half v);
2405#endif
2406
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002407#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002408extern half2 __attribute__((const, overloadable))
2409 log(half2 v);
2410#endif
2411
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002412#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002413extern half3 __attribute__((const, overloadable))
2414 log(half3 v);
2415#endif
2416
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002417#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002418extern half4 __attribute__((const, overloadable))
2419 log(half4 v);
2420#endif
2421
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002422/*
2423 * log10: Base 10 logarithm
2424 *
2425 * Returns the base 10 logarithm.
2426 *
2427 * See also native_log10().
2428 */
2429extern float __attribute__((const, overloadable))
2430 log10(float v);
2431
2432extern float2 __attribute__((const, overloadable))
2433 log10(float2 v);
2434
2435extern float3 __attribute__((const, overloadable))
2436 log10(float3 v);
2437
2438extern float4 __attribute__((const, overloadable))
2439 log10(float4 v);
2440
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002441#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002442extern half __attribute__((const, overloadable))
2443 log10(half v);
2444#endif
2445
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002446#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002447extern half2 __attribute__((const, overloadable))
2448 log10(half2 v);
2449#endif
2450
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002451#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002452extern half3 __attribute__((const, overloadable))
2453 log10(half3 v);
2454#endif
2455
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002456#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002457extern half4 __attribute__((const, overloadable))
2458 log10(half4 v);
2459#endif
2460
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002461/*
2462 * log1p: Natural logarithm of a value plus 1
2463 *
2464 * Returns the natural logarithm of (v + 1.f).
2465 *
2466 * See also native_log1p().
2467 */
2468extern float __attribute__((const, overloadable))
2469 log1p(float v);
2470
2471extern float2 __attribute__((const, overloadable))
2472 log1p(float2 v);
2473
2474extern float3 __attribute__((const, overloadable))
2475 log1p(float3 v);
2476
2477extern float4 __attribute__((const, overloadable))
2478 log1p(float4 v);
2479
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002480#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002481extern half __attribute__((const, overloadable))
2482 log1p(half v);
2483#endif
2484
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002485#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002486extern half2 __attribute__((const, overloadable))
2487 log1p(half2 v);
2488#endif
2489
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002490#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002491extern half3 __attribute__((const, overloadable))
2492 log1p(half3 v);
2493#endif
2494
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002495#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002496extern half4 __attribute__((const, overloadable))
2497 log1p(half4 v);
2498#endif
2499
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002500/*
2501 * log2: Base 2 logarithm
2502 *
2503 * Returns the base 2 logarithm.
2504 *
2505 * See also native_log2().
2506 */
2507extern float __attribute__((const, overloadable))
2508 log2(float v);
2509
2510extern float2 __attribute__((const, overloadable))
2511 log2(float2 v);
2512
2513extern float3 __attribute__((const, overloadable))
2514 log2(float3 v);
2515
2516extern float4 __attribute__((const, overloadable))
2517 log2(float4 v);
2518
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002519#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002520extern half __attribute__((const, overloadable))
2521 log2(half v);
2522#endif
2523
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002524#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002525extern half2 __attribute__((const, overloadable))
2526 log2(half2 v);
2527#endif
2528
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002529#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002530extern half3 __attribute__((const, overloadable))
2531 log2(half3 v);
2532#endif
2533
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002534#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002535extern half4 __attribute__((const, overloadable))
2536 log2(half4 v);
2537#endif
2538
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002539/*
2540 * logb: Base two exponent
2541 *
2542 * Returns the base two exponent of a value, where the mantissa is between
2543 * 1.f (inclusive) and 2.f (exclusive).
2544 *
2545 * For example, logb(8.5f) returns 3.f.
2546 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002547 * Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002548 *
2549 * ilogb() is similar but returns an integer.
2550 */
2551extern float __attribute__((const, overloadable))
2552 logb(float v);
2553
2554extern float2 __attribute__((const, overloadable))
2555 logb(float2 v);
2556
2557extern float3 __attribute__((const, overloadable))
2558 logb(float3 v);
2559
2560extern float4 __attribute__((const, overloadable))
2561 logb(float4 v);
2562
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002563#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002564extern half __attribute__((const, overloadable))
2565 logb(half v);
2566#endif
2567
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002568#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002569extern half2 __attribute__((const, overloadable))
2570 logb(half2 v);
2571#endif
2572
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002573#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002574extern half3 __attribute__((const, overloadable))
2575 logb(half3 v);
2576#endif
2577
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002578#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002579extern half4 __attribute__((const, overloadable))
2580 logb(half4 v);
2581#endif
2582
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002583/*
2584 * mad: Multiply and add
2585 *
2586 * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
2587 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002588 * This function is similar to fma(). fma() retains full precision of the multiplied result
2589 * and rounds only after the addition. mad() rounds after the multiplication and the addition.
2590 * In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002591 */
2592extern float __attribute__((const, overloadable))
2593 mad(float multiplicand1, float multiplicand2, float offset);
2594
2595extern float2 __attribute__((const, overloadable))
2596 mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
2597
2598extern float3 __attribute__((const, overloadable))
2599 mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
2600
2601extern float4 __attribute__((const, overloadable))
2602 mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
2603
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002604#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002605extern half __attribute__((const, overloadable))
2606 mad(half multiplicand1, half multiplicand2, half offset);
2607#endif
2608
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002609#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002610extern half2 __attribute__((const, overloadable))
2611 mad(half2 multiplicand1, half2 multiplicand2, half2 offset);
2612#endif
2613
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002614#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002615extern half3 __attribute__((const, overloadable))
2616 mad(half3 multiplicand1, half3 multiplicand2, half3 offset);
2617#endif
2618
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002619#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002620extern half4 __attribute__((const, overloadable))
2621 mad(half4 multiplicand1, half4 multiplicand2, half4 offset);
2622#endif
2623
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002624/*
2625 * max: Maximum
2626 *
2627 * Returns the maximum value of two arguments.
2628 */
2629extern float __attribute__((const, overloadable))
2630 max(float a, float b);
2631
2632extern float2 __attribute__((const, overloadable))
2633 max(float2 a, float2 b);
2634
2635extern float3 __attribute__((const, overloadable))
2636 max(float3 a, float3 b);
2637
2638extern float4 __attribute__((const, overloadable))
2639 max(float4 a, float4 b);
2640
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002641#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002642extern half __attribute__((const, overloadable))
2643 max(half a, half b);
2644#endif
2645
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002646#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002647extern half2 __attribute__((const, overloadable))
2648 max(half2 a, half2 b);
2649#endif
2650
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002651#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002652extern half3 __attribute__((const, overloadable))
2653 max(half3 a, half3 b);
2654#endif
2655
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002656#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002657extern half4 __attribute__((const, overloadable))
2658 max(half4 a, half4 b);
2659#endif
2660
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07002661extern float2 __attribute__((const, overloadable))
2662 max(float2 a, float b);
2663
2664extern float3 __attribute__((const, overloadable))
2665 max(float3 a, float b);
2666
2667extern float4 __attribute__((const, overloadable))
2668 max(float4 a, float b);
2669
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002670#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002671extern half2 __attribute__((const, overloadable))
2672 max(half2 a, half b);
2673#endif
2674
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002675#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002676extern half3 __attribute__((const, overloadable))
2677 max(half3 a, half b);
2678#endif
2679
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08002680#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002681extern half4 __attribute__((const, overloadable))
2682 max(half4 a, half b);
2683#endif
2684
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002685#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2686static inline char __attribute__((const, overloadable))
2687 max(char a, char b) {
2688 return (a > b ? a : b);
2689}
2690#endif
2691
2692#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2693static inline uchar __attribute__((const, overloadable))
2694 max(uchar a, uchar b) {
2695 return (a > b ? a : b);
2696}
2697#endif
2698
2699#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2700static inline short __attribute__((const, overloadable))
2701 max(short a, short b) {
2702 return (a > b ? a : b);
2703}
2704#endif
2705
2706#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2707static inline ushort __attribute__((const, overloadable))
2708 max(ushort a, ushort b) {
2709 return (a > b ? a : b);
2710}
2711#endif
2712
2713#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2714static inline int __attribute__((const, overloadable))
2715 max(int a, int b) {
2716 return (a > b ? a : b);
2717}
2718#endif
2719
2720#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2721static inline uint __attribute__((const, overloadable))
2722 max(uint a, uint b) {
2723 return (a > b ? a : b);
2724}
2725#endif
2726
2727#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2728static inline char2 __attribute__((const, overloadable))
2729 max(char2 a, char2 b) {
2730 char2 tmp;
2731 tmp.x = (a.x > b.x ? a.x : b.x);
2732 tmp.y = (a.y > b.y ? a.y : b.y);
2733 return tmp;
2734}
2735#endif
2736
2737#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2738static inline uchar2 __attribute__((const, overloadable))
2739 max(uchar2 a, uchar2 b) {
2740 uchar2 tmp;
2741 tmp.x = (a.x > b.x ? a.x : b.x);
2742 tmp.y = (a.y > b.y ? a.y : b.y);
2743 return tmp;
2744}
2745#endif
2746
2747#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2748static inline short2 __attribute__((const, overloadable))
2749 max(short2 a, short2 b) {
2750 short2 tmp;
2751 tmp.x = (a.x > b.x ? a.x : b.x);
2752 tmp.y = (a.y > b.y ? a.y : b.y);
2753 return tmp;
2754}
2755#endif
2756
2757#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2758static inline ushort2 __attribute__((const, overloadable))
2759 max(ushort2 a, ushort2 b) {
2760 ushort2 tmp;
2761 tmp.x = (a.x > b.x ? a.x : b.x);
2762 tmp.y = (a.y > b.y ? a.y : b.y);
2763 return tmp;
2764}
2765#endif
2766
2767#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2768static inline int2 __attribute__((const, overloadable))
2769 max(int2 a, int2 b) {
2770 int2 tmp;
2771 tmp.x = (a.x > b.x ? a.x : b.x);
2772 tmp.y = (a.y > b.y ? a.y : b.y);
2773 return tmp;
2774}
2775#endif
2776
2777#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2778static inline uint2 __attribute__((const, overloadable))
2779 max(uint2 a, uint2 b) {
2780 uint2 tmp;
2781 tmp.x = (a.x > b.x ? a.x : b.x);
2782 tmp.y = (a.y > b.y ? a.y : b.y);
2783 return tmp;
2784}
2785#endif
2786
2787#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2788static inline char3 __attribute__((const, overloadable))
2789 max(char3 a, char3 b) {
2790 char3 tmp;
2791 tmp.x = (a.x > b.x ? a.x : b.x);
2792 tmp.y = (a.y > b.y ? a.y : b.y);
2793 tmp.z = (a.z > b.z ? a.z : b.z);
2794 return tmp;
2795}
2796#endif
2797
2798#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2799static inline uchar3 __attribute__((const, overloadable))
2800 max(uchar3 a, uchar3 b) {
2801 uchar3 tmp;
2802 tmp.x = (a.x > b.x ? a.x : b.x);
2803 tmp.y = (a.y > b.y ? a.y : b.y);
2804 tmp.z = (a.z > b.z ? a.z : b.z);
2805 return tmp;
2806}
2807#endif
2808
2809#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2810static inline short3 __attribute__((const, overloadable))
2811 max(short3 a, short3 b) {
2812 short3 tmp;
2813 tmp.x = (a.x > b.x ? a.x : b.x);
2814 tmp.y = (a.y > b.y ? a.y : b.y);
2815 tmp.z = (a.z > b.z ? a.z : b.z);
2816 return tmp;
2817}
2818#endif
2819
2820#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2821static inline ushort3 __attribute__((const, overloadable))
2822 max(ushort3 a, ushort3 b) {
2823 ushort3 tmp;
2824 tmp.x = (a.x > b.x ? a.x : b.x);
2825 tmp.y = (a.y > b.y ? a.y : b.y);
2826 tmp.z = (a.z > b.z ? a.z : b.z);
2827 return tmp;
2828}
2829#endif
2830
2831#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2832static inline int3 __attribute__((const, overloadable))
2833 max(int3 a, int3 b) {
2834 int3 tmp;
2835 tmp.x = (a.x > b.x ? a.x : b.x);
2836 tmp.y = (a.y > b.y ? a.y : b.y);
2837 tmp.z = (a.z > b.z ? a.z : b.z);
2838 return tmp;
2839}
2840#endif
2841
2842#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2843static inline uint3 __attribute__((const, overloadable))
2844 max(uint3 a, uint3 b) {
2845 uint3 tmp;
2846 tmp.x = (a.x > b.x ? a.x : b.x);
2847 tmp.y = (a.y > b.y ? a.y : b.y);
2848 tmp.z = (a.z > b.z ? a.z : b.z);
2849 return tmp;
2850}
2851#endif
2852
2853#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2854static inline char4 __attribute__((const, overloadable))
2855 max(char4 a, char4 b) {
2856 char4 tmp;
2857 tmp.x = (a.x > b.x ? a.x : b.x);
2858 tmp.y = (a.y > b.y ? a.y : b.y);
2859 tmp.z = (a.z > b.z ? a.z : b.z);
2860 tmp.w = (a.w > b.w ? a.w : b.w);
2861 return tmp;
2862}
2863#endif
2864
2865#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2866static inline uchar4 __attribute__((const, overloadable))
2867 max(uchar4 a, uchar4 b) {
2868 uchar4 tmp;
2869 tmp.x = (a.x > b.x ? a.x : b.x);
2870 tmp.y = (a.y > b.y ? a.y : b.y);
2871 tmp.z = (a.z > b.z ? a.z : b.z);
2872 tmp.w = (a.w > b.w ? a.w : b.w);
2873 return tmp;
2874}
2875#endif
2876
2877#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2878static inline short4 __attribute__((const, overloadable))
2879 max(short4 a, short4 b) {
2880 short4 tmp;
2881 tmp.x = (a.x > b.x ? a.x : b.x);
2882 tmp.y = (a.y > b.y ? a.y : b.y);
2883 tmp.z = (a.z > b.z ? a.z : b.z);
2884 tmp.w = (a.w > b.w ? a.w : b.w);
2885 return tmp;
2886}
2887#endif
2888
2889#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2890static inline ushort4 __attribute__((const, overloadable))
2891 max(ushort4 a, ushort4 b) {
2892 ushort4 tmp;
2893 tmp.x = (a.x > b.x ? a.x : b.x);
2894 tmp.y = (a.y > b.y ? a.y : b.y);
2895 tmp.z = (a.z > b.z ? a.z : b.z);
2896 tmp.w = (a.w > b.w ? a.w : b.w);
2897 return tmp;
2898}
2899#endif
2900
2901#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2902static inline int4 __attribute__((const, overloadable))
2903 max(int4 a, int4 b) {
2904 int4 tmp;
2905 tmp.x = (a.x > b.x ? a.x : b.x);
2906 tmp.y = (a.y > b.y ? a.y : b.y);
2907 tmp.z = (a.z > b.z ? a.z : b.z);
2908 tmp.w = (a.w > b.w ? a.w : b.w);
2909 return tmp;
2910}
2911#endif
2912
2913#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2914static inline uint4 __attribute__((const, overloadable))
2915 max(uint4 a, uint4 b) {
2916 uint4 tmp;
2917 tmp.x = (a.x > b.x ? a.x : b.x);
2918 tmp.y = (a.y > b.y ? a.y : b.y);
2919 tmp.z = (a.z > b.z ? a.z : b.z);
2920 tmp.w = (a.w > b.w ? a.w : b.w);
2921 return tmp;
2922}
2923#endif
2924
2925#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2926extern char __attribute__((const, overloadable))
2927 max(char a, char b);
2928#endif
2929
2930#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2931extern char2 __attribute__((const, overloadable))
2932 max(char2 a, char2 b);
2933#endif
2934
2935#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2936extern char3 __attribute__((const, overloadable))
2937 max(char3 a, char3 b);
2938#endif
2939
2940#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2941extern char4 __attribute__((const, overloadable))
2942 max(char4 a, char4 b);
2943#endif
2944
2945#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2946extern uchar __attribute__((const, overloadable))
2947 max(uchar a, uchar b);
2948#endif
2949
2950#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2951extern uchar2 __attribute__((const, overloadable))
2952 max(uchar2 a, uchar2 b);
2953#endif
2954
2955#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2956extern uchar3 __attribute__((const, overloadable))
2957 max(uchar3 a, uchar3 b);
2958#endif
2959
2960#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2961extern uchar4 __attribute__((const, overloadable))
2962 max(uchar4 a, uchar4 b);
2963#endif
2964
2965#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2966extern short __attribute__((const, overloadable))
2967 max(short a, short b);
2968#endif
2969
2970#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2971extern short2 __attribute__((const, overloadable))
2972 max(short2 a, short2 b);
2973#endif
2974
2975#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2976extern short3 __attribute__((const, overloadable))
2977 max(short3 a, short3 b);
2978#endif
2979
2980#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2981extern short4 __attribute__((const, overloadable))
2982 max(short4 a, short4 b);
2983#endif
2984
2985#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2986extern ushort __attribute__((const, overloadable))
2987 max(ushort a, ushort b);
2988#endif
2989
2990#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2991extern ushort2 __attribute__((const, overloadable))
2992 max(ushort2 a, ushort2 b);
2993#endif
2994
2995#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2996extern ushort3 __attribute__((const, overloadable))
2997 max(ushort3 a, ushort3 b);
2998#endif
2999
3000#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3001extern ushort4 __attribute__((const, overloadable))
3002 max(ushort4 a, ushort4 b);
3003#endif
3004
3005#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3006extern int __attribute__((const, overloadable))
3007 max(int a, int b);
3008#endif
3009
3010#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3011extern int2 __attribute__((const, overloadable))
3012 max(int2 a, int2 b);
3013#endif
3014
3015#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3016extern int3 __attribute__((const, overloadable))
3017 max(int3 a, int3 b);
3018#endif
3019
3020#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3021extern int4 __attribute__((const, overloadable))
3022 max(int4 a, int4 b);
3023#endif
3024
3025#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3026extern uint __attribute__((const, overloadable))
3027 max(uint a, uint b);
3028#endif
3029
3030#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3031extern uint2 __attribute__((const, overloadable))
3032 max(uint2 a, uint2 b);
3033#endif
3034
3035#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3036extern uint3 __attribute__((const, overloadable))
3037 max(uint3 a, uint3 b);
3038#endif
3039
3040#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3041extern uint4 __attribute__((const, overloadable))
3042 max(uint4 a, uint4 b);
3043#endif
3044
3045#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3046extern long __attribute__((const, overloadable))
3047 max(long a, long b);
3048#endif
3049
3050#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3051extern long2 __attribute__((const, overloadable))
3052 max(long2 a, long2 b);
3053#endif
3054
3055#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3056extern long3 __attribute__((const, overloadable))
3057 max(long3 a, long3 b);
3058#endif
3059
3060#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3061extern long4 __attribute__((const, overloadable))
3062 max(long4 a, long4 b);
3063#endif
3064
3065#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3066extern ulong __attribute__((const, overloadable))
3067 max(ulong a, ulong b);
3068#endif
3069
3070#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3071extern ulong2 __attribute__((const, overloadable))
3072 max(ulong2 a, ulong2 b);
3073#endif
3074
3075#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3076extern ulong3 __attribute__((const, overloadable))
3077 max(ulong3 a, ulong3 b);
3078#endif
3079
3080#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3081extern ulong4 __attribute__((const, overloadable))
3082 max(ulong4 a, ulong4 b);
3083#endif
3084
3085/*
3086 * min: Minimum
3087 *
3088 * Returns the minimum value of two arguments.
3089 */
3090extern float __attribute__((const, overloadable))
3091 min(float a, float b);
3092
3093extern float2 __attribute__((const, overloadable))
3094 min(float2 a, float2 b);
3095
3096extern float3 __attribute__((const, overloadable))
3097 min(float3 a, float3 b);
3098
3099extern float4 __attribute__((const, overloadable))
3100 min(float4 a, float4 b);
3101
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003102#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003103extern half __attribute__((const, overloadable))
3104 min(half a, half b);
3105#endif
3106
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003107#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003108extern half2 __attribute__((const, overloadable))
3109 min(half2 a, half2 b);
3110#endif
3111
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003112#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003113extern half3 __attribute__((const, overloadable))
3114 min(half3 a, half3 b);
3115#endif
3116
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003117#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003118extern half4 __attribute__((const, overloadable))
3119 min(half4 a, half4 b);
3120#endif
3121
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07003122extern float2 __attribute__((const, overloadable))
3123 min(float2 a, float b);
3124
3125extern float3 __attribute__((const, overloadable))
3126 min(float3 a, float b);
3127
3128extern float4 __attribute__((const, overloadable))
3129 min(float4 a, float b);
3130
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003131#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003132extern half2 __attribute__((const, overloadable))
3133 min(half2 a, half b);
3134#endif
3135
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003136#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003137extern half3 __attribute__((const, overloadable))
3138 min(half3 a, half b);
3139#endif
3140
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003141#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003142extern half4 __attribute__((const, overloadable))
3143 min(half4 a, half b);
3144#endif
3145
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003146#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3147static inline char __attribute__((const, overloadable))
3148 min(char a, char b) {
3149 return (a < b ? a : b);
3150}
3151#endif
3152
3153#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3154static inline uchar __attribute__((const, overloadable))
3155 min(uchar a, uchar b) {
3156 return (a < b ? a : b);
3157}
3158#endif
3159
3160#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3161static inline short __attribute__((const, overloadable))
3162 min(short a, short b) {
3163 return (a < b ? a : b);
3164}
3165#endif
3166
3167#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3168static inline ushort __attribute__((const, overloadable))
3169 min(ushort a, ushort b) {
3170 return (a < b ? a : b);
3171}
3172#endif
3173
3174#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3175static inline int __attribute__((const, overloadable))
3176 min(int a, int b) {
3177 return (a < b ? a : b);
3178}
3179#endif
3180
3181#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3182static inline uint __attribute__((const, overloadable))
3183 min(uint a, uint b) {
3184 return (a < b ? a : b);
3185}
3186#endif
3187
3188#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3189static inline char2 __attribute__((const, overloadable))
3190 min(char2 a, char2 b) {
3191 char2 tmp;
3192 tmp.x = (a.x < b.x ? a.x : b.x);
3193 tmp.y = (a.y < b.y ? a.y : b.y);
3194 return tmp;
3195}
3196#endif
3197
3198#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3199static inline uchar2 __attribute__((const, overloadable))
3200 min(uchar2 a, uchar2 b) {
3201 uchar2 tmp;
3202 tmp.x = (a.x < b.x ? a.x : b.x);
3203 tmp.y = (a.y < b.y ? a.y : b.y);
3204 return tmp;
3205}
3206#endif
3207
3208#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3209static inline short2 __attribute__((const, overloadable))
3210 min(short2 a, short2 b) {
3211 short2 tmp;
3212 tmp.x = (a.x < b.x ? a.x : b.x);
3213 tmp.y = (a.y < b.y ? a.y : b.y);
3214 return tmp;
3215}
3216#endif
3217
3218#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3219static inline ushort2 __attribute__((const, overloadable))
3220 min(ushort2 a, ushort2 b) {
3221 ushort2 tmp;
3222 tmp.x = (a.x < b.x ? a.x : b.x);
3223 tmp.y = (a.y < b.y ? a.y : b.y);
3224 return tmp;
3225}
3226#endif
3227
3228#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3229static inline int2 __attribute__((const, overloadable))
3230 min(int2 a, int2 b) {
3231 int2 tmp;
3232 tmp.x = (a.x < b.x ? a.x : b.x);
3233 tmp.y = (a.y < b.y ? a.y : b.y);
3234 return tmp;
3235}
3236#endif
3237
3238#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3239static inline uint2 __attribute__((const, overloadable))
3240 min(uint2 a, uint2 b) {
3241 uint2 tmp;
3242 tmp.x = (a.x < b.x ? a.x : b.x);
3243 tmp.y = (a.y < b.y ? a.y : b.y);
3244 return tmp;
3245}
3246#endif
3247
3248#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3249static inline char3 __attribute__((const, overloadable))
3250 min(char3 a, char3 b) {
3251 char3 tmp;
3252 tmp.x = (a.x < b.x ? a.x : b.x);
3253 tmp.y = (a.y < b.y ? a.y : b.y);
3254 tmp.z = (a.z < b.z ? a.z : b.z);
3255 return tmp;
3256}
3257#endif
3258
3259#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3260static inline uchar3 __attribute__((const, overloadable))
3261 min(uchar3 a, uchar3 b) {
3262 uchar3 tmp;
3263 tmp.x = (a.x < b.x ? a.x : b.x);
3264 tmp.y = (a.y < b.y ? a.y : b.y);
3265 tmp.z = (a.z < b.z ? a.z : b.z);
3266 return tmp;
3267}
3268#endif
3269
3270#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3271static inline short3 __attribute__((const, overloadable))
3272 min(short3 a, short3 b) {
3273 short3 tmp;
3274 tmp.x = (a.x < b.x ? a.x : b.x);
3275 tmp.y = (a.y < b.y ? a.y : b.y);
3276 tmp.z = (a.z < b.z ? a.z : b.z);
3277 return tmp;
3278}
3279#endif
3280
3281#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3282static inline ushort3 __attribute__((const, overloadable))
3283 min(ushort3 a, ushort3 b) {
3284 ushort3 tmp;
3285 tmp.x = (a.x < b.x ? a.x : b.x);
3286 tmp.y = (a.y < b.y ? a.y : b.y);
3287 tmp.z = (a.z < b.z ? a.z : b.z);
3288 return tmp;
3289}
3290#endif
3291
3292#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3293static inline int3 __attribute__((const, overloadable))
3294 min(int3 a, int3 b) {
3295 int3 tmp;
3296 tmp.x = (a.x < b.x ? a.x : b.x);
3297 tmp.y = (a.y < b.y ? a.y : b.y);
3298 tmp.z = (a.z < b.z ? a.z : b.z);
3299 return tmp;
3300}
3301#endif
3302
3303#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3304static inline uint3 __attribute__((const, overloadable))
3305 min(uint3 a, uint3 b) {
3306 uint3 tmp;
3307 tmp.x = (a.x < b.x ? a.x : b.x);
3308 tmp.y = (a.y < b.y ? a.y : b.y);
3309 tmp.z = (a.z < b.z ? a.z : b.z);
3310 return tmp;
3311}
3312#endif
3313
3314#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3315static inline char4 __attribute__((const, overloadable))
3316 min(char4 a, char4 b) {
3317 char4 tmp;
3318 tmp.x = (a.x < b.x ? a.x : b.x);
3319 tmp.y = (a.y < b.y ? a.y : b.y);
3320 tmp.z = (a.z < b.z ? a.z : b.z);
3321 tmp.w = (a.w < b.w ? a.w : b.w);
3322 return tmp;
3323}
3324#endif
3325
3326#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3327static inline uchar4 __attribute__((const, overloadable))
3328 min(uchar4 a, uchar4 b) {
3329 uchar4 tmp;
3330 tmp.x = (a.x < b.x ? a.x : b.x);
3331 tmp.y = (a.y < b.y ? a.y : b.y);
3332 tmp.z = (a.z < b.z ? a.z : b.z);
3333 tmp.w = (a.w < b.w ? a.w : b.w);
3334 return tmp;
3335}
3336#endif
3337
3338#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3339static inline short4 __attribute__((const, overloadable))
3340 min(short4 a, short4 b) {
3341 short4 tmp;
3342 tmp.x = (a.x < b.x ? a.x : b.x);
3343 tmp.y = (a.y < b.y ? a.y : b.y);
3344 tmp.z = (a.z < b.z ? a.z : b.z);
3345 tmp.w = (a.w < b.w ? a.w : b.w);
3346 return tmp;
3347}
3348#endif
3349
3350#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3351static inline ushort4 __attribute__((const, overloadable))
3352 min(ushort4 a, ushort4 b) {
3353 ushort4 tmp;
3354 tmp.x = (a.x < b.x ? a.x : b.x);
3355 tmp.y = (a.y < b.y ? a.y : b.y);
3356 tmp.z = (a.z < b.z ? a.z : b.z);
3357 tmp.w = (a.w < b.w ? a.w : b.w);
3358 return tmp;
3359}
3360#endif
3361
3362#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3363static inline int4 __attribute__((const, overloadable))
3364 min(int4 a, int4 b) {
3365 int4 tmp;
3366 tmp.x = (a.x < b.x ? a.x : b.x);
3367 tmp.y = (a.y < b.y ? a.y : b.y);
3368 tmp.z = (a.z < b.z ? a.z : b.z);
3369 tmp.w = (a.w < b.w ? a.w : b.w);
3370 return tmp;
3371}
3372#endif
3373
3374#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3375static inline uint4 __attribute__((const, overloadable))
3376 min(uint4 a, uint4 b) {
3377 uint4 tmp;
3378 tmp.x = (a.x < b.x ? a.x : b.x);
3379 tmp.y = (a.y < b.y ? a.y : b.y);
3380 tmp.z = (a.z < b.z ? a.z : b.z);
3381 tmp.w = (a.w < b.w ? a.w : b.w);
3382 return tmp;
3383}
3384#endif
3385
3386#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3387extern char __attribute__((const, overloadable))
3388 min(char a, char b);
3389#endif
3390
3391#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3392extern char2 __attribute__((const, overloadable))
3393 min(char2 a, char2 b);
3394#endif
3395
3396#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3397extern char3 __attribute__((const, overloadable))
3398 min(char3 a, char3 b);
3399#endif
3400
3401#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3402extern char4 __attribute__((const, overloadable))
3403 min(char4 a, char4 b);
3404#endif
3405
3406#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3407extern uchar __attribute__((const, overloadable))
3408 min(uchar a, uchar b);
3409#endif
3410
3411#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3412extern uchar2 __attribute__((const, overloadable))
3413 min(uchar2 a, uchar2 b);
3414#endif
3415
3416#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3417extern uchar3 __attribute__((const, overloadable))
3418 min(uchar3 a, uchar3 b);
3419#endif
3420
3421#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3422extern uchar4 __attribute__((const, overloadable))
3423 min(uchar4 a, uchar4 b);
3424#endif
3425
3426#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3427extern short __attribute__((const, overloadable))
3428 min(short a, short b);
3429#endif
3430
3431#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3432extern short2 __attribute__((const, overloadable))
3433 min(short2 a, short2 b);
3434#endif
3435
3436#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3437extern short3 __attribute__((const, overloadable))
3438 min(short3 a, short3 b);
3439#endif
3440
3441#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3442extern short4 __attribute__((const, overloadable))
3443 min(short4 a, short4 b);
3444#endif
3445
3446#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3447extern ushort __attribute__((const, overloadable))
3448 min(ushort a, ushort b);
3449#endif
3450
3451#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3452extern ushort2 __attribute__((const, overloadable))
3453 min(ushort2 a, ushort2 b);
3454#endif
3455
3456#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3457extern ushort3 __attribute__((const, overloadable))
3458 min(ushort3 a, ushort3 b);
3459#endif
3460
3461#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3462extern ushort4 __attribute__((const, overloadable))
3463 min(ushort4 a, ushort4 b);
3464#endif
3465
3466#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3467extern int __attribute__((const, overloadable))
3468 min(int a, int b);
3469#endif
3470
3471#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3472extern int2 __attribute__((const, overloadable))
3473 min(int2 a, int2 b);
3474#endif
3475
3476#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3477extern int3 __attribute__((const, overloadable))
3478 min(int3 a, int3 b);
3479#endif
3480
3481#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3482extern int4 __attribute__((const, overloadable))
3483 min(int4 a, int4 b);
3484#endif
3485
3486#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3487extern uint __attribute__((const, overloadable))
3488 min(uint a, uint b);
3489#endif
3490
3491#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3492extern uint2 __attribute__((const, overloadable))
3493 min(uint2 a, uint2 b);
3494#endif
3495
3496#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3497extern uint3 __attribute__((const, overloadable))
3498 min(uint3 a, uint3 b);
3499#endif
3500
3501#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3502extern uint4 __attribute__((const, overloadable))
3503 min(uint4 a, uint4 b);
3504#endif
3505
3506#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3507extern long __attribute__((const, overloadable))
3508 min(long a, long b);
3509#endif
3510
3511#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3512extern long2 __attribute__((const, overloadable))
3513 min(long2 a, long2 b);
3514#endif
3515
3516#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3517extern long3 __attribute__((const, overloadable))
3518 min(long3 a, long3 b);
3519#endif
3520
3521#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3522extern long4 __attribute__((const, overloadable))
3523 min(long4 a, long4 b);
3524#endif
3525
3526#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3527extern ulong __attribute__((const, overloadable))
3528 min(ulong a, ulong b);
3529#endif
3530
3531#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3532extern ulong2 __attribute__((const, overloadable))
3533 min(ulong2 a, ulong2 b);
3534#endif
3535
3536#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3537extern ulong3 __attribute__((const, overloadable))
3538 min(ulong3 a, ulong3 b);
3539#endif
3540
3541#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3542extern ulong4 __attribute__((const, overloadable))
3543 min(ulong4 a, ulong4 b);
3544#endif
3545
3546/*
3547 * mix: Mixes two values
3548 *
3549 * Returns start + ((stop - start) * fraction).
3550 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003551 * This can be useful for mixing two values. For example, to create a new color that is
3552 * 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003553 */
3554extern float __attribute__((const, overloadable))
3555 mix(float start, float stop, float fraction);
3556
3557extern float2 __attribute__((const, overloadable))
3558 mix(float2 start, float2 stop, float2 fraction);
3559
3560extern float3 __attribute__((const, overloadable))
3561 mix(float3 start, float3 stop, float3 fraction);
3562
3563extern float4 __attribute__((const, overloadable))
3564 mix(float4 start, float4 stop, float4 fraction);
3565
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003566#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003567extern half __attribute__((const, overloadable))
3568 mix(half start, half stop, half fraction);
3569#endif
3570
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003571#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003572extern half2 __attribute__((const, overloadable))
3573 mix(half2 start, half2 stop, half2 fraction);
3574#endif
3575
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003576#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003577extern half3 __attribute__((const, overloadable))
3578 mix(half3 start, half3 stop, half3 fraction);
3579#endif
3580
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003581#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003582extern half4 __attribute__((const, overloadable))
3583 mix(half4 start, half4 stop, half4 fraction);
3584#endif
3585
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003586extern float2 __attribute__((const, overloadable))
3587 mix(float2 start, float2 stop, float fraction);
3588
3589extern float3 __attribute__((const, overloadable))
3590 mix(float3 start, float3 stop, float fraction);
3591
3592extern float4 __attribute__((const, overloadable))
3593 mix(float4 start, float4 stop, float fraction);
3594
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003595#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003596extern half2 __attribute__((const, overloadable))
3597 mix(half2 start, half2 stop, half fraction);
3598#endif
3599
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003600#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003601extern half3 __attribute__((const, overloadable))
3602 mix(half3 start, half3 stop, half fraction);
3603#endif
3604
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003605#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003606extern half4 __attribute__((const, overloadable))
3607 mix(half4 start, half4 stop, half fraction);
3608#endif
3609
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003610/*
3611 * modf: Integral and fractional components
3612 *
3613 * Returns the integral and fractional components of a number.
3614 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003615 * Both components will have the same sign as x. For example, for an input of -3.72f,
Pirama Arumuga Nainare6128ff2015-12-06 17:32:42 -08003616 * *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003617 *
3618 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003619 * v: Source value.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07003620 * integral_part: *integral_part will be set to the integral portion of the number.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003621 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003622 * Returns: Floating point portion of the value.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003623 */
3624extern float __attribute__((overloadable))
3625 modf(float v, float* integral_part);
3626
3627extern float2 __attribute__((overloadable))
3628 modf(float2 v, float2* integral_part);
3629
3630extern float3 __attribute__((overloadable))
3631 modf(float3 v, float3* integral_part);
3632
3633extern float4 __attribute__((overloadable))
3634 modf(float4 v, float4* integral_part);
3635
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003636#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08003637extern half __attribute__((overloadable))
3638 modf(half v, half* integral_part);
3639#endif
3640
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003641#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08003642extern half2 __attribute__((overloadable))
3643 modf(half2 v, half2* integral_part);
3644#endif
3645
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003646#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08003647extern half3 __attribute__((overloadable))
3648 modf(half3 v, half3* integral_part);
3649#endif
3650
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003651#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf300e172016-02-05 16:51:30 -08003652extern half4 __attribute__((overloadable))
3653 modf(half4 v, half4* integral_part);
3654#endif
3655
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003656/*
3657 * nan: Not a Number
3658 *
3659 * Returns a NaN value (Not a Number).
3660 *
3661 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07003662 * v: Not used.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003663 */
3664extern float __attribute__((const, overloadable))
3665 nan(uint v);
3666
3667/*
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003668 * nan_half: Not a Number
3669 *
3670 * Returns a half-precision floating point NaN value (Not a Number).
3671 */
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003672#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003673extern half __attribute__((const, overloadable))
3674 nan_half(void);
3675#endif
3676
3677/*
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003678 * native_acos: Approximate inverse cosine
3679 *
3680 * Returns the approximate inverse cosine, in radians.
3681 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003682 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003683 *
3684 * See also acos().
3685 */
3686#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3687extern float __attribute__((const, overloadable))
3688 native_acos(float v);
3689#endif
3690
3691#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3692extern float2 __attribute__((const, overloadable))
3693 native_acos(float2 v);
3694#endif
3695
3696#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3697extern float3 __attribute__((const, overloadable))
3698 native_acos(float3 v);
3699#endif
3700
3701#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3702extern float4 __attribute__((const, overloadable))
3703 native_acos(float4 v);
3704#endif
3705
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003706#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003707extern half __attribute__((const, overloadable))
3708 native_acos(half v);
3709#endif
3710
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003711#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003712extern half2 __attribute__((const, overloadable))
3713 native_acos(half2 v);
3714#endif
3715
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003716#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003717extern half3 __attribute__((const, overloadable))
3718 native_acos(half3 v);
3719#endif
3720
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003721#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003722extern half4 __attribute__((const, overloadable))
3723 native_acos(half4 v);
3724#endif
3725
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003726/*
3727 * native_acosh: Approximate inverse hyperbolic cosine
3728 *
3729 * Returns the approximate inverse hyperbolic cosine, in radians.
3730 *
3731 * See also acosh().
3732 */
3733#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3734extern float __attribute__((const, overloadable))
3735 native_acosh(float v);
3736#endif
3737
3738#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3739extern float2 __attribute__((const, overloadable))
3740 native_acosh(float2 v);
3741#endif
3742
3743#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3744extern float3 __attribute__((const, overloadable))
3745 native_acosh(float3 v);
3746#endif
3747
3748#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3749extern float4 __attribute__((const, overloadable))
3750 native_acosh(float4 v);
3751#endif
3752
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003753#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003754extern half __attribute__((const, overloadable))
3755 native_acosh(half v);
3756#endif
3757
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003758#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003759extern half2 __attribute__((const, overloadable))
3760 native_acosh(half2 v);
3761#endif
3762
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003763#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003764extern half3 __attribute__((const, overloadable))
3765 native_acosh(half3 v);
3766#endif
3767
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003768#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003769extern half4 __attribute__((const, overloadable))
3770 native_acosh(half4 v);
3771#endif
3772
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003773/*
3774 * native_acospi: Approximate inverse cosine divided by pi
3775 *
3776 * Returns the approximate inverse cosine in radians, divided by pi.
3777 *
3778 * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
3779 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003780 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003781 *
3782 * See also acospi().
3783 */
3784#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3785extern float __attribute__((const, overloadable))
3786 native_acospi(float v);
3787#endif
3788
3789#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3790extern float2 __attribute__((const, overloadable))
3791 native_acospi(float2 v);
3792#endif
3793
3794#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3795extern float3 __attribute__((const, overloadable))
3796 native_acospi(float3 v);
3797#endif
3798
3799#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3800extern float4 __attribute__((const, overloadable))
3801 native_acospi(float4 v);
3802#endif
3803
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003804#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003805extern half __attribute__((const, overloadable))
3806 native_acospi(half v);
3807#endif
3808
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003809#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003810extern half2 __attribute__((const, overloadable))
3811 native_acospi(half2 v);
3812#endif
3813
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003814#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003815extern half3 __attribute__((const, overloadable))
3816 native_acospi(half3 v);
3817#endif
3818
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003819#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003820extern half4 __attribute__((const, overloadable))
3821 native_acospi(half4 v);
3822#endif
3823
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003824/*
3825 * native_asin: Approximate inverse sine
3826 *
3827 * Returns the approximate inverse sine, in radians.
3828 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003829 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003830 *
3831 * See also asin().
3832 */
3833#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3834extern float __attribute__((const, overloadable))
3835 native_asin(float v);
3836#endif
3837
3838#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3839extern float2 __attribute__((const, overloadable))
3840 native_asin(float2 v);
3841#endif
3842
3843#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3844extern float3 __attribute__((const, overloadable))
3845 native_asin(float3 v);
3846#endif
3847
3848#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3849extern float4 __attribute__((const, overloadable))
3850 native_asin(float4 v);
3851#endif
3852
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003853#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003854extern half __attribute__((const, overloadable))
3855 native_asin(half v);
3856#endif
3857
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003858#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003859extern half2 __attribute__((const, overloadable))
3860 native_asin(half2 v);
3861#endif
3862
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003863#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003864extern half3 __attribute__((const, overloadable))
3865 native_asin(half3 v);
3866#endif
3867
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003868#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003869extern half4 __attribute__((const, overloadable))
3870 native_asin(half4 v);
3871#endif
3872
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003873/*
3874 * native_asinh: Approximate inverse hyperbolic sine
3875 *
3876 * Returns the approximate inverse hyperbolic sine, in radians.
3877 *
3878 * See also asinh().
3879 */
3880#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3881extern float __attribute__((const, overloadable))
3882 native_asinh(float v);
3883#endif
3884
3885#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3886extern float2 __attribute__((const, overloadable))
3887 native_asinh(float2 v);
3888#endif
3889
3890#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3891extern float3 __attribute__((const, overloadable))
3892 native_asinh(float3 v);
3893#endif
3894
3895#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3896extern float4 __attribute__((const, overloadable))
3897 native_asinh(float4 v);
3898#endif
3899
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003900#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003901extern half __attribute__((const, overloadable))
3902 native_asinh(half v);
3903#endif
3904
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003905#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003906extern half2 __attribute__((const, overloadable))
3907 native_asinh(half2 v);
3908#endif
3909
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003910#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003911extern half3 __attribute__((const, overloadable))
3912 native_asinh(half3 v);
3913#endif
3914
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003915#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003916extern half4 __attribute__((const, overloadable))
3917 native_asinh(half4 v);
3918#endif
3919
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003920/*
3921 * native_asinpi: Approximate inverse sine divided by pi
3922 *
3923 * Returns the approximate inverse sine in radians, divided by pi.
3924 *
3925 * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
3926 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003927 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003928 *
3929 * See also asinpi().
3930 */
3931#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3932extern float __attribute__((const, overloadable))
3933 native_asinpi(float v);
3934#endif
3935
3936#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3937extern float2 __attribute__((const, overloadable))
3938 native_asinpi(float2 v);
3939#endif
3940
3941#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3942extern float3 __attribute__((const, overloadable))
3943 native_asinpi(float3 v);
3944#endif
3945
3946#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3947extern float4 __attribute__((const, overloadable))
3948 native_asinpi(float4 v);
3949#endif
3950
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003951#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003952extern half __attribute__((const, overloadable))
3953 native_asinpi(half v);
3954#endif
3955
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003956#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003957extern half2 __attribute__((const, overloadable))
3958 native_asinpi(half2 v);
3959#endif
3960
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003961#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003962extern half3 __attribute__((const, overloadable))
3963 native_asinpi(half3 v);
3964#endif
3965
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003966#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003967extern half4 __attribute__((const, overloadable))
3968 native_asinpi(half4 v);
3969#endif
3970
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003971/*
3972 * native_atan: Approximate inverse tangent
3973 *
3974 * Returns the approximate inverse tangent, in radians.
3975 *
3976 * See also atan().
3977 */
3978#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3979extern float __attribute__((const, overloadable))
3980 native_atan(float v);
3981#endif
3982
3983#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3984extern float2 __attribute__((const, overloadable))
3985 native_atan(float2 v);
3986#endif
3987
3988#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3989extern float3 __attribute__((const, overloadable))
3990 native_atan(float3 v);
3991#endif
3992
3993#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3994extern float4 __attribute__((const, overloadable))
3995 native_atan(float4 v);
3996#endif
3997
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08003998#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003999extern half __attribute__((const, overloadable))
4000 native_atan(half v);
4001#endif
4002
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004003#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004004extern half2 __attribute__((const, overloadable))
4005 native_atan(half2 v);
4006#endif
4007
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004008#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004009extern half3 __attribute__((const, overloadable))
4010 native_atan(half3 v);
4011#endif
4012
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004013#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004014extern half4 __attribute__((const, overloadable))
4015 native_atan(half4 v);
4016#endif
4017
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004018/*
4019 * native_atan2: Approximate inverse tangent of a ratio
4020 *
4021 * Returns the approximate inverse tangent of (numerator / denominator), in radians.
4022 *
4023 * See also atan2().
4024 *
4025 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004026 * numerator: Numerator.
4027 * denominator: Denominator. Can be 0.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004028 */
4029#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4030extern float __attribute__((const, overloadable))
4031 native_atan2(float numerator, float denominator);
4032#endif
4033
4034#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4035extern float2 __attribute__((const, overloadable))
4036 native_atan2(float2 numerator, float2 denominator);
4037#endif
4038
4039#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4040extern float3 __attribute__((const, overloadable))
4041 native_atan2(float3 numerator, float3 denominator);
4042#endif
4043
4044#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4045extern float4 __attribute__((const, overloadable))
4046 native_atan2(float4 numerator, float4 denominator);
4047#endif
4048
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004049#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004050extern half __attribute__((const, overloadable))
4051 native_atan2(half numerator, half denominator);
4052#endif
4053
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004054#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004055extern half2 __attribute__((const, overloadable))
4056 native_atan2(half2 numerator, half2 denominator);
4057#endif
4058
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004059#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004060extern half3 __attribute__((const, overloadable))
4061 native_atan2(half3 numerator, half3 denominator);
4062#endif
4063
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004064#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004065extern half4 __attribute__((const, overloadable))
4066 native_atan2(half4 numerator, half4 denominator);
4067#endif
4068
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004069/*
4070 * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi
4071 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004072 * Returns the approximate inverse tangent of (numerator / denominator),
4073 * in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004074 *
4075 * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
4076 *
4077 * See also atan2pi().
4078 *
4079 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004080 * numerator: Numerator.
4081 * denominator: Denominator. Can be 0.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004082 */
4083#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4084extern float __attribute__((const, overloadable))
4085 native_atan2pi(float numerator, float denominator);
4086#endif
4087
4088#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4089extern float2 __attribute__((const, overloadable))
4090 native_atan2pi(float2 numerator, float2 denominator);
4091#endif
4092
4093#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4094extern float3 __attribute__((const, overloadable))
4095 native_atan2pi(float3 numerator, float3 denominator);
4096#endif
4097
4098#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4099extern float4 __attribute__((const, overloadable))
4100 native_atan2pi(float4 numerator, float4 denominator);
4101#endif
4102
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004103#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004104extern half __attribute__((const, overloadable))
4105 native_atan2pi(half numerator, half denominator);
4106#endif
4107
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004108#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004109extern half2 __attribute__((const, overloadable))
4110 native_atan2pi(half2 numerator, half2 denominator);
4111#endif
4112
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004113#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004114extern half3 __attribute__((const, overloadable))
4115 native_atan2pi(half3 numerator, half3 denominator);
4116#endif
4117
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004118#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004119extern half4 __attribute__((const, overloadable))
4120 native_atan2pi(half4 numerator, half4 denominator);
4121#endif
4122
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004123/*
4124 * native_atanh: Approximate inverse hyperbolic tangent
4125 *
4126 * Returns the approximate inverse hyperbolic tangent, in radians.
4127 *
4128 * See also atanh().
4129 */
4130#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4131extern float __attribute__((const, overloadable))
4132 native_atanh(float v);
4133#endif
4134
4135#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4136extern float2 __attribute__((const, overloadable))
4137 native_atanh(float2 v);
4138#endif
4139
4140#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4141extern float3 __attribute__((const, overloadable))
4142 native_atanh(float3 v);
4143#endif
4144
4145#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4146extern float4 __attribute__((const, overloadable))
4147 native_atanh(float4 v);
4148#endif
4149
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004150#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004151extern half __attribute__((const, overloadable))
4152 native_atanh(half v);
4153#endif
4154
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004155#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004156extern half2 __attribute__((const, overloadable))
4157 native_atanh(half2 v);
4158#endif
4159
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004160#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004161extern half3 __attribute__((const, overloadable))
4162 native_atanh(half3 v);
4163#endif
4164
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004165#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004166extern half4 __attribute__((const, overloadable))
4167 native_atanh(half4 v);
4168#endif
4169
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004170/*
4171 * native_atanpi: Approximate inverse tangent divided by pi
4172 *
4173 * Returns the approximate inverse tangent in radians, divided by pi.
4174 *
4175 * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
4176 *
4177 * See also atanpi().
4178 */
4179#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4180extern float __attribute__((const, overloadable))
4181 native_atanpi(float v);
4182#endif
4183
4184#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4185extern float2 __attribute__((const, overloadable))
4186 native_atanpi(float2 v);
4187#endif
4188
4189#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4190extern float3 __attribute__((const, overloadable))
4191 native_atanpi(float3 v);
4192#endif
4193
4194#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4195extern float4 __attribute__((const, overloadable))
4196 native_atanpi(float4 v);
4197#endif
4198
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004199#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004200extern half __attribute__((const, overloadable))
4201 native_atanpi(half v);
4202#endif
4203
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004204#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004205extern half2 __attribute__((const, overloadable))
4206 native_atanpi(half2 v);
4207#endif
4208
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004209#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004210extern half3 __attribute__((const, overloadable))
4211 native_atanpi(half3 v);
4212#endif
4213
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004214#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004215extern half4 __attribute__((const, overloadable))
4216 native_atanpi(half4 v);
4217#endif
4218
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004219/*
4220 * native_cbrt: Approximate cube root
4221 *
4222 * Returns the approximate cubic root.
4223 *
4224 * See also cbrt().
4225 */
4226#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4227extern float __attribute__((const, overloadable))
4228 native_cbrt(float v);
4229#endif
4230
4231#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4232extern float2 __attribute__((const, overloadable))
4233 native_cbrt(float2 v);
4234#endif
4235
4236#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4237extern float3 __attribute__((const, overloadable))
4238 native_cbrt(float3 v);
4239#endif
4240
4241#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4242extern float4 __attribute__((const, overloadable))
4243 native_cbrt(float4 v);
4244#endif
4245
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004246#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004247extern half __attribute__((const, overloadable))
4248 native_cbrt(half v);
4249#endif
4250
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004251#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004252extern half2 __attribute__((const, overloadable))
4253 native_cbrt(half2 v);
4254#endif
4255
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004256#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004257extern half3 __attribute__((const, overloadable))
4258 native_cbrt(half3 v);
4259#endif
4260
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004261#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004262extern half4 __attribute__((const, overloadable))
4263 native_cbrt(half4 v);
4264#endif
4265
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004266/*
4267 * native_cos: Approximate cosine
4268 *
4269 * Returns the approximate cosine of an angle measured in radians.
4270 *
4271 * See also cos().
4272 */
4273#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4274extern float __attribute__((const, overloadable))
4275 native_cos(float v);
4276#endif
4277
4278#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4279extern float2 __attribute__((const, overloadable))
4280 native_cos(float2 v);
4281#endif
4282
4283#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4284extern float3 __attribute__((const, overloadable))
4285 native_cos(float3 v);
4286#endif
4287
4288#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4289extern float4 __attribute__((const, overloadable))
4290 native_cos(float4 v);
4291#endif
4292
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004293#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004294extern half __attribute__((const, overloadable))
4295 native_cos(half v);
4296#endif
4297
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004298#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004299extern half2 __attribute__((const, overloadable))
4300 native_cos(half2 v);
4301#endif
4302
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004303#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004304extern half3 __attribute__((const, overloadable))
4305 native_cos(half3 v);
4306#endif
4307
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004308#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004309extern half4 __attribute__((const, overloadable))
4310 native_cos(half4 v);
4311#endif
4312
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004313/*
4314 * native_cosh: Approximate hypebolic cosine
4315 *
4316 * Returns the approximate hypebolic cosine.
4317 *
4318 * See also cosh().
4319 */
4320#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4321extern float __attribute__((const, overloadable))
4322 native_cosh(float v);
4323#endif
4324
4325#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4326extern float2 __attribute__((const, overloadable))
4327 native_cosh(float2 v);
4328#endif
4329
4330#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4331extern float3 __attribute__((const, overloadable))
4332 native_cosh(float3 v);
4333#endif
4334
4335#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4336extern float4 __attribute__((const, overloadable))
4337 native_cosh(float4 v);
4338#endif
4339
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004340#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004341extern half __attribute__((const, overloadable))
4342 native_cosh(half v);
4343#endif
4344
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004345#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004346extern half2 __attribute__((const, overloadable))
4347 native_cosh(half2 v);
4348#endif
4349
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004350#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004351extern half3 __attribute__((const, overloadable))
4352 native_cosh(half3 v);
4353#endif
4354
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004355#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004356extern half4 __attribute__((const, overloadable))
4357 native_cosh(half4 v);
4358#endif
4359
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004360/*
4361 * native_cospi: Approximate cosine of a number multiplied by pi
4362 *
4363 * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
4364 *
4365 * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
4366 *
4367 * See also cospi().
4368 */
4369#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4370extern float __attribute__((const, overloadable))
4371 native_cospi(float v);
4372#endif
4373
4374#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4375extern float2 __attribute__((const, overloadable))
4376 native_cospi(float2 v);
4377#endif
4378
4379#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4380extern float3 __attribute__((const, overloadable))
4381 native_cospi(float3 v);
4382#endif
4383
4384#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4385extern float4 __attribute__((const, overloadable))
4386 native_cospi(float4 v);
4387#endif
4388
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004389#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004390extern half __attribute__((const, overloadable))
4391 native_cospi(half v);
4392#endif
4393
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004394#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004395extern half2 __attribute__((const, overloadable))
4396 native_cospi(half2 v);
4397#endif
4398
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004399#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004400extern half3 __attribute__((const, overloadable))
4401 native_cospi(half3 v);
4402#endif
4403
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004404#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004405extern half4 __attribute__((const, overloadable))
4406 native_cospi(half4 v);
4407#endif
4408
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004409/*
4410 * native_divide: Approximate division
4411 *
4412 * Computes the approximate division of two values.
4413 */
4414#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4415extern float __attribute__((const, overloadable))
4416 native_divide(float left_vector, float right_vector);
4417#endif
4418
4419#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4420extern float2 __attribute__((const, overloadable))
4421 native_divide(float2 left_vector, float2 right_vector);
4422#endif
4423
4424#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4425extern float3 __attribute__((const, overloadable))
4426 native_divide(float3 left_vector, float3 right_vector);
4427#endif
4428
4429#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4430extern float4 __attribute__((const, overloadable))
4431 native_divide(float4 left_vector, float4 right_vector);
4432#endif
4433
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004434#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004435extern half __attribute__((const, overloadable))
4436 native_divide(half left_vector, half right_vector);
4437#endif
4438
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004439#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004440extern half2 __attribute__((const, overloadable))
4441 native_divide(half2 left_vector, half2 right_vector);
4442#endif
4443
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004444#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004445extern half3 __attribute__((const, overloadable))
4446 native_divide(half3 left_vector, half3 right_vector);
4447#endif
4448
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004449#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004450extern half4 __attribute__((const, overloadable))
4451 native_divide(half4 left_vector, half4 right_vector);
4452#endif
4453
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004454/*
4455 * native_exp: Approximate e raised to a number
4456 *
4457 * Fast approximate exp.
4458 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004459 * It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
4460 * expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004461 *
4462 * See also exp().
4463 */
4464#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4465extern float __attribute__((const, overloadable))
4466 native_exp(float v);
4467#endif
4468
4469#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4470extern float2 __attribute__((const, overloadable))
4471 native_exp(float2 v);
4472#endif
4473
4474#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4475extern float3 __attribute__((const, overloadable))
4476 native_exp(float3 v);
4477#endif
4478
4479#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4480extern float4 __attribute__((const, overloadable))
4481 native_exp(float4 v);
4482#endif
4483
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004484#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004485extern half __attribute__((const, overloadable))
4486 native_exp(half v);
4487#endif
4488
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004489#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004490extern half2 __attribute__((const, overloadable))
4491 native_exp(half2 v);
4492#endif
4493
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004494#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004495extern half3 __attribute__((const, overloadable))
4496 native_exp(half3 v);
4497#endif
4498
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004499#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004500extern half4 __attribute__((const, overloadable))
4501 native_exp(half4 v);
4502#endif
4503
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004504/*
4505 * native_exp10: Approximate 10 raised to a number
4506 *
4507 * Fast approximate exp10.
4508 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004509 * It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
4510 * expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004511 *
4512 * See also exp10().
4513 */
4514#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4515extern float __attribute__((const, overloadable))
4516 native_exp10(float v);
4517#endif
4518
4519#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4520extern float2 __attribute__((const, overloadable))
4521 native_exp10(float2 v);
4522#endif
4523
4524#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4525extern float3 __attribute__((const, overloadable))
4526 native_exp10(float3 v);
4527#endif
4528
4529#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4530extern float4 __attribute__((const, overloadable))
4531 native_exp10(float4 v);
4532#endif
4533
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004534#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004535extern half __attribute__((const, overloadable))
4536 native_exp10(half v);
4537#endif
4538
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004539#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004540extern half2 __attribute__((const, overloadable))
4541 native_exp10(half2 v);
4542#endif
4543
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004544#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004545extern half3 __attribute__((const, overloadable))
4546 native_exp10(half3 v);
4547#endif
4548
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004549#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004550extern half4 __attribute__((const, overloadable))
4551 native_exp10(half4 v);
4552#endif
4553
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004554/*
4555 * native_exp2: Approximate 2 raised to a number
4556 *
4557 * Fast approximate exp2.
4558 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004559 * It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
4560 * expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004561 *
4562 * See also exp2().
4563 */
4564#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4565extern float __attribute__((const, overloadable))
4566 native_exp2(float v);
4567#endif
4568
4569#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4570extern float2 __attribute__((const, overloadable))
4571 native_exp2(float2 v);
4572#endif
4573
4574#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4575extern float3 __attribute__((const, overloadable))
4576 native_exp2(float3 v);
4577#endif
4578
4579#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4580extern float4 __attribute__((const, overloadable))
4581 native_exp2(float4 v);
4582#endif
4583
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004584#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004585extern half __attribute__((const, overloadable))
4586 native_exp2(half v);
4587#endif
4588
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004589#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004590extern half2 __attribute__((const, overloadable))
4591 native_exp2(half2 v);
4592#endif
4593
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004594#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004595extern half3 __attribute__((const, overloadable))
4596 native_exp2(half3 v);
4597#endif
4598
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004599#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004600extern half4 __attribute__((const, overloadable))
4601 native_exp2(half4 v);
4602#endif
4603
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004604/*
4605 * native_expm1: Approximate e raised to a number minus one
4606 *
4607 * Returns the approximate (e ^ v) - 1.
4608 *
4609 * See also expm1().
4610 */
4611#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4612extern float __attribute__((const, overloadable))
4613 native_expm1(float v);
4614#endif
4615
4616#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4617extern float2 __attribute__((const, overloadable))
4618 native_expm1(float2 v);
4619#endif
4620
4621#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4622extern float3 __attribute__((const, overloadable))
4623 native_expm1(float3 v);
4624#endif
4625
4626#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4627extern float4 __attribute__((const, overloadable))
4628 native_expm1(float4 v);
4629#endif
4630
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004631#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004632extern half __attribute__((const, overloadable))
4633 native_expm1(half v);
4634#endif
4635
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004636#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004637extern half2 __attribute__((const, overloadable))
4638 native_expm1(half2 v);
4639#endif
4640
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004641#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004642extern half3 __attribute__((const, overloadable))
4643 native_expm1(half3 v);
4644#endif
4645
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004646#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004647extern half4 __attribute__((const, overloadable))
4648 native_expm1(half4 v);
4649#endif
4650
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004651/*
4652 * native_hypot: Approximate hypotenuse
4653 *
4654 * Returns the approximate native_sqrt(a * a + b * b)
4655 *
4656 * See also hypot().
4657 */
4658#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4659extern float __attribute__((const, overloadable))
4660 native_hypot(float a, float b);
4661#endif
4662
4663#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4664extern float2 __attribute__((const, overloadable))
4665 native_hypot(float2 a, float2 b);
4666#endif
4667
4668#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4669extern float3 __attribute__((const, overloadable))
4670 native_hypot(float3 a, float3 b);
4671#endif
4672
4673#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4674extern float4 __attribute__((const, overloadable))
4675 native_hypot(float4 a, float4 b);
4676#endif
4677
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004678#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004679extern half __attribute__((const, overloadable))
4680 native_hypot(half a, half b);
4681#endif
4682
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004683#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004684extern half2 __attribute__((const, overloadable))
4685 native_hypot(half2 a, half2 b);
4686#endif
4687
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004688#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004689extern half3 __attribute__((const, overloadable))
4690 native_hypot(half3 a, half3 b);
4691#endif
4692
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004693#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004694extern half4 __attribute__((const, overloadable))
4695 native_hypot(half4 a, half4 b);
4696#endif
4697
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004698/*
4699 * native_log: Approximate natural logarithm
4700 *
4701 * Fast approximate log.
4702 *
4703 * It is not accurate for values very close to zero.
4704 *
4705 * See also log().
4706 */
4707#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4708extern float __attribute__((const, overloadable))
4709 native_log(float v);
4710#endif
4711
4712#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4713extern float2 __attribute__((const, overloadable))
4714 native_log(float2 v);
4715#endif
4716
4717#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4718extern float3 __attribute__((const, overloadable))
4719 native_log(float3 v);
4720#endif
4721
4722#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4723extern float4 __attribute__((const, overloadable))
4724 native_log(float4 v);
4725#endif
4726
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004727#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004728extern half __attribute__((const, overloadable))
4729 native_log(half v);
4730#endif
4731
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004732#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004733extern half2 __attribute__((const, overloadable))
4734 native_log(half2 v);
4735#endif
4736
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004737#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004738extern half3 __attribute__((const, overloadable))
4739 native_log(half3 v);
4740#endif
4741
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004742#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004743extern half4 __attribute__((const, overloadable))
4744 native_log(half4 v);
4745#endif
4746
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004747/*
4748 * native_log10: Approximate base 10 logarithm
4749 *
4750 * Fast approximate log10.
4751 *
4752 * It is not accurate for values very close to zero.
4753 *
4754 * See also log10().
4755 */
4756#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4757extern float __attribute__((const, overloadable))
4758 native_log10(float v);
4759#endif
4760
4761#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4762extern float2 __attribute__((const, overloadable))
4763 native_log10(float2 v);
4764#endif
4765
4766#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4767extern float3 __attribute__((const, overloadable))
4768 native_log10(float3 v);
4769#endif
4770
4771#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4772extern float4 __attribute__((const, overloadable))
4773 native_log10(float4 v);
4774#endif
4775
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004776#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004777extern half __attribute__((const, overloadable))
4778 native_log10(half v);
4779#endif
4780
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004781#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004782extern half2 __attribute__((const, overloadable))
4783 native_log10(half2 v);
4784#endif
4785
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004786#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004787extern half3 __attribute__((const, overloadable))
4788 native_log10(half3 v);
4789#endif
4790
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004791#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004792extern half4 __attribute__((const, overloadable))
4793 native_log10(half4 v);
4794#endif
4795
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004796/*
4797 * native_log1p: Approximate natural logarithm of a value plus 1
4798 *
4799 * Returns the approximate natural logarithm of (v + 1.0f)
4800 *
4801 * See also log1p().
4802 */
4803#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4804extern float __attribute__((const, overloadable))
4805 native_log1p(float v);
4806#endif
4807
4808#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4809extern float2 __attribute__((const, overloadable))
4810 native_log1p(float2 v);
4811#endif
4812
4813#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4814extern float3 __attribute__((const, overloadable))
4815 native_log1p(float3 v);
4816#endif
4817
4818#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4819extern float4 __attribute__((const, overloadable))
4820 native_log1p(float4 v);
4821#endif
4822
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004823#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004824extern half __attribute__((const, overloadable))
4825 native_log1p(half v);
4826#endif
4827
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004828#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004829extern half2 __attribute__((const, overloadable))
4830 native_log1p(half2 v);
4831#endif
4832
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004833#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004834extern half3 __attribute__((const, overloadable))
4835 native_log1p(half3 v);
4836#endif
4837
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004838#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004839extern half4 __attribute__((const, overloadable))
4840 native_log1p(half4 v);
4841#endif
4842
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004843/*
4844 * native_log2: Approximate base 2 logarithm
4845 *
4846 * Fast approximate log2.
4847 *
4848 * It is not accurate for values very close to zero.
4849 *
4850 * See also log2().
4851 */
4852#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4853extern float __attribute__((const, overloadable))
4854 native_log2(float v);
4855#endif
4856
4857#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4858extern float2 __attribute__((const, overloadable))
4859 native_log2(float2 v);
4860#endif
4861
4862#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4863extern float3 __attribute__((const, overloadable))
4864 native_log2(float3 v);
4865#endif
4866
4867#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4868extern float4 __attribute__((const, overloadable))
4869 native_log2(float4 v);
4870#endif
4871
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004872#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004873extern half __attribute__((const, overloadable))
4874 native_log2(half v);
4875#endif
4876
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004877#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004878extern half2 __attribute__((const, overloadable))
4879 native_log2(half2 v);
4880#endif
4881
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004882#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004883extern half3 __attribute__((const, overloadable))
4884 native_log2(half3 v);
4885#endif
4886
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004887#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004888extern half4 __attribute__((const, overloadable))
4889 native_log2(half4 v);
4890#endif
4891
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004892/*
4893 * native_powr: Approximate positive base raised to an exponent
4894 *
4895 * Fast approximate (base ^ exponent).
4896 *
4897 * See also powr().
4898 *
4899 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07004900 * base: Must be between 0.f and 256.f. The function is not accurate for values very close to zero.
4901 * exponent: Must be between -15.f and 15.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004902 */
4903#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4904extern float __attribute__((const, overloadable))
4905 native_powr(float base, float exponent);
4906#endif
4907
4908#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4909extern float2 __attribute__((const, overloadable))
4910 native_powr(float2 base, float2 exponent);
4911#endif
4912
4913#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4914extern float3 __attribute__((const, overloadable))
4915 native_powr(float3 base, float3 exponent);
4916#endif
4917
4918#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4919extern float4 __attribute__((const, overloadable))
4920 native_powr(float4 base, float4 exponent);
4921#endif
4922
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004923#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004924extern half __attribute__((const, overloadable))
4925 native_powr(half base, half exponent);
4926#endif
4927
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004928#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004929extern half2 __attribute__((const, overloadable))
4930 native_powr(half2 base, half2 exponent);
4931#endif
4932
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004933#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004934extern half3 __attribute__((const, overloadable))
4935 native_powr(half3 base, half3 exponent);
4936#endif
4937
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004938#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004939extern half4 __attribute__((const, overloadable))
4940 native_powr(half4 base, half4 exponent);
4941#endif
4942
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004943/*
4944 * native_recip: Approximate reciprocal
4945 *
4946 * Returns the approximate approximate reciprocal of a value.
4947 *
4948 * See also half_recip().
4949 */
4950#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4951extern float __attribute__((const, overloadable))
4952 native_recip(float v);
4953#endif
4954
4955#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4956extern float2 __attribute__((const, overloadable))
4957 native_recip(float2 v);
4958#endif
4959
4960#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4961extern float3 __attribute__((const, overloadable))
4962 native_recip(float3 v);
4963#endif
4964
4965#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4966extern float4 __attribute__((const, overloadable))
4967 native_recip(float4 v);
4968#endif
4969
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004970#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004971extern half __attribute__((const, overloadable))
4972 native_recip(half v);
4973#endif
4974
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004975#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004976extern half2 __attribute__((const, overloadable))
4977 native_recip(half2 v);
4978#endif
4979
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004980#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004981extern half3 __attribute__((const, overloadable))
4982 native_recip(half3 v);
4983#endif
4984
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08004985#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004986extern half4 __attribute__((const, overloadable))
4987 native_recip(half4 v);
4988#endif
4989
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004990/*
4991 * native_rootn: Approximate nth root
4992 *
4993 * Compute the approximate Nth root of a value.
4994 *
4995 * See also rootn().
4996 */
4997#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4998extern float __attribute__((const, overloadable))
4999 native_rootn(float v, int n);
5000#endif
5001
5002#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5003extern float2 __attribute__((const, overloadable))
5004 native_rootn(float2 v, int2 n);
5005#endif
5006
5007#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5008extern float3 __attribute__((const, overloadable))
5009 native_rootn(float3 v, int3 n);
5010#endif
5011
5012#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5013extern float4 __attribute__((const, overloadable))
5014 native_rootn(float4 v, int4 n);
5015#endif
5016
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005017#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005018extern half __attribute__((const, overloadable))
5019 native_rootn(half v, int n);
5020#endif
5021
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005022#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005023extern half2 __attribute__((const, overloadable))
5024 native_rootn(half2 v, int2 n);
5025#endif
5026
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005027#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005028extern half3 __attribute__((const, overloadable))
5029 native_rootn(half3 v, int3 n);
5030#endif
5031
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005032#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005033extern half4 __attribute__((const, overloadable))
5034 native_rootn(half4 v, int4 n);
5035#endif
5036
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005037/*
5038 * native_rsqrt: Approximate reciprocal of a square root
5039 *
5040 * Returns approximate (1 / sqrt(v)).
5041 *
5042 * See also rsqrt(), half_rsqrt().
5043 */
5044#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5045extern float __attribute__((const, overloadable))
5046 native_rsqrt(float v);
5047#endif
5048
5049#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5050extern float2 __attribute__((const, overloadable))
5051 native_rsqrt(float2 v);
5052#endif
5053
5054#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5055extern float3 __attribute__((const, overloadable))
5056 native_rsqrt(float3 v);
5057#endif
5058
5059#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5060extern float4 __attribute__((const, overloadable))
5061 native_rsqrt(float4 v);
5062#endif
5063
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005064#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005065extern half __attribute__((const, overloadable))
5066 native_rsqrt(half v);
5067#endif
5068
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005069#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005070extern half2 __attribute__((const, overloadable))
5071 native_rsqrt(half2 v);
5072#endif
5073
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005074#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005075extern half3 __attribute__((const, overloadable))
5076 native_rsqrt(half3 v);
5077#endif
5078
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005079#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005080extern half4 __attribute__((const, overloadable))
5081 native_rsqrt(half4 v);
5082#endif
5083
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005084/*
5085 * native_sin: Approximate sine
5086 *
5087 * Returns the approximate sine of an angle measured in radians.
5088 *
5089 * See also sin().
5090 */
5091#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5092extern float __attribute__((const, overloadable))
5093 native_sin(float v);
5094#endif
5095
5096#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5097extern float2 __attribute__((const, overloadable))
5098 native_sin(float2 v);
5099#endif
5100
5101#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5102extern float3 __attribute__((const, overloadable))
5103 native_sin(float3 v);
5104#endif
5105
5106#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5107extern float4 __attribute__((const, overloadable))
5108 native_sin(float4 v);
5109#endif
5110
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005111#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005112extern half __attribute__((const, overloadable))
5113 native_sin(half v);
5114#endif
5115
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005116#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005117extern half2 __attribute__((const, overloadable))
5118 native_sin(half2 v);
5119#endif
5120
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005121#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005122extern half3 __attribute__((const, overloadable))
5123 native_sin(half3 v);
5124#endif
5125
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005126#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005127extern half4 __attribute__((const, overloadable))
5128 native_sin(half4 v);
5129#endif
5130
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005131/*
5132 * native_sincos: Approximate sine and cosine
5133 *
5134 * Returns the approximate sine and cosine of a value.
5135 *
5136 * See also sincos().
5137 *
5138 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005139 * v: Incoming value in radians.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07005140 * cos: *cos will be set to the cosine value.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005141 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005142 * Returns: Sine.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005143 */
5144#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5145extern float __attribute__((overloadable))
5146 native_sincos(float v, float* cos);
5147#endif
5148
5149#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5150extern float2 __attribute__((overloadable))
5151 native_sincos(float2 v, float2* cos);
5152#endif
5153
5154#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5155extern float3 __attribute__((overloadable))
5156 native_sincos(float3 v, float3* cos);
5157#endif
5158
5159#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5160extern float4 __attribute__((overloadable))
5161 native_sincos(float4 v, float4* cos);
5162#endif
5163
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005164#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005165extern half __attribute__((overloadable))
5166 native_sincos(half v, half* cos);
5167#endif
5168
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005169#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005170extern half2 __attribute__((overloadable))
5171 native_sincos(half2 v, half2* cos);
5172#endif
5173
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005174#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005175extern half3 __attribute__((overloadable))
5176 native_sincos(half3 v, half3* cos);
5177#endif
5178
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005179#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005180extern half4 __attribute__((overloadable))
5181 native_sincos(half4 v, half4* cos);
5182#endif
5183
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005184/*
5185 * native_sinh: Approximate hyperbolic sine
5186 *
5187 * Returns the approximate hyperbolic sine of a value specified in radians.
5188 *
5189 * See also sinh().
5190 */
5191#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5192extern float __attribute__((const, overloadable))
5193 native_sinh(float v);
5194#endif
5195
5196#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5197extern float2 __attribute__((const, overloadable))
5198 native_sinh(float2 v);
5199#endif
5200
5201#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5202extern float3 __attribute__((const, overloadable))
5203 native_sinh(float3 v);
5204#endif
5205
5206#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5207extern float4 __attribute__((const, overloadable))
5208 native_sinh(float4 v);
5209#endif
5210
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005211#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005212extern half __attribute__((const, overloadable))
5213 native_sinh(half v);
5214#endif
5215
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005216#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005217extern half2 __attribute__((const, overloadable))
5218 native_sinh(half2 v);
5219#endif
5220
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005221#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005222extern half3 __attribute__((const, overloadable))
5223 native_sinh(half3 v);
5224#endif
5225
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005226#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005227extern half4 __attribute__((const, overloadable))
5228 native_sinh(half4 v);
5229#endif
5230
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005231/*
5232 * native_sinpi: Approximate sine of a number multiplied by pi
5233 *
5234 * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
5235 *
5236 * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
5237 *
5238 * See also sinpi().
5239 */
5240#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5241extern float __attribute__((const, overloadable))
5242 native_sinpi(float v);
5243#endif
5244
5245#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5246extern float2 __attribute__((const, overloadable))
5247 native_sinpi(float2 v);
5248#endif
5249
5250#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5251extern float3 __attribute__((const, overloadable))
5252 native_sinpi(float3 v);
5253#endif
5254
5255#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5256extern float4 __attribute__((const, overloadable))
5257 native_sinpi(float4 v);
5258#endif
5259
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005260#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005261extern half __attribute__((const, overloadable))
5262 native_sinpi(half v);
5263#endif
5264
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005265#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005266extern half2 __attribute__((const, overloadable))
5267 native_sinpi(half2 v);
5268#endif
5269
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005270#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005271extern half3 __attribute__((const, overloadable))
5272 native_sinpi(half3 v);
5273#endif
5274
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005275#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005276extern half4 __attribute__((const, overloadable))
5277 native_sinpi(half4 v);
5278#endif
5279
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005280/*
5281 * native_sqrt: Approximate square root
5282 *
5283 * Returns the approximate sqrt(v).
5284 *
5285 * See also sqrt(), half_sqrt().
5286 */
5287#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5288extern float __attribute__((const, overloadable))
5289 native_sqrt(float v);
5290#endif
5291
5292#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5293extern float2 __attribute__((const, overloadable))
5294 native_sqrt(float2 v);
5295#endif
5296
5297#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5298extern float3 __attribute__((const, overloadable))
5299 native_sqrt(float3 v);
5300#endif
5301
5302#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5303extern float4 __attribute__((const, overloadable))
5304 native_sqrt(float4 v);
5305#endif
5306
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005307#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005308extern half __attribute__((const, overloadable))
5309 native_sqrt(half v);
5310#endif
5311
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005312#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005313extern half2 __attribute__((const, overloadable))
5314 native_sqrt(half2 v);
5315#endif
5316
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005317#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005318extern half3 __attribute__((const, overloadable))
5319 native_sqrt(half3 v);
5320#endif
5321
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005322#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005323extern half4 __attribute__((const, overloadable))
5324 native_sqrt(half4 v);
5325#endif
5326
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005327/*
5328 * native_tan: Approximate tangent
5329 *
5330 * Returns the approximate tangent of an angle measured in radians.
5331 */
5332#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5333extern float __attribute__((const, overloadable))
5334 native_tan(float v);
5335#endif
5336
5337#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5338extern float2 __attribute__((const, overloadable))
5339 native_tan(float2 v);
5340#endif
5341
5342#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5343extern float3 __attribute__((const, overloadable))
5344 native_tan(float3 v);
5345#endif
5346
5347#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5348extern float4 __attribute__((const, overloadable))
5349 native_tan(float4 v);
5350#endif
5351
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005352#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005353extern half __attribute__((const, overloadable))
5354 native_tan(half v);
5355#endif
5356
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005357#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005358extern half2 __attribute__((const, overloadable))
5359 native_tan(half2 v);
5360#endif
5361
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005362#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005363extern half3 __attribute__((const, overloadable))
5364 native_tan(half3 v);
5365#endif
5366
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005367#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005368extern half4 __attribute__((const, overloadable))
5369 native_tan(half4 v);
5370#endif
5371
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005372/*
5373 * native_tanh: Approximate hyperbolic tangent
5374 *
5375 * Returns the approximate hyperbolic tangent of a value.
5376 *
5377 * See also tanh().
5378 */
5379#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5380extern float __attribute__((const, overloadable))
5381 native_tanh(float v);
5382#endif
5383
5384#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5385extern float2 __attribute__((const, overloadable))
5386 native_tanh(float2 v);
5387#endif
5388
5389#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5390extern float3 __attribute__((const, overloadable))
5391 native_tanh(float3 v);
5392#endif
5393
5394#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5395extern float4 __attribute__((const, overloadable))
5396 native_tanh(float4 v);
5397#endif
5398
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005399#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005400extern half __attribute__((const, overloadable))
5401 native_tanh(half v);
5402#endif
5403
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005404#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005405extern half2 __attribute__((const, overloadable))
5406 native_tanh(half2 v);
5407#endif
5408
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005409#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005410extern half3 __attribute__((const, overloadable))
5411 native_tanh(half3 v);
5412#endif
5413
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005414#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005415extern half4 __attribute__((const, overloadable))
5416 native_tanh(half4 v);
5417#endif
5418
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005419/*
5420 * native_tanpi: Approximate tangent of a number multiplied by pi
5421 *
5422 * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
5423 *
5424 * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
5425 *
5426 * See also tanpi().
5427 */
5428#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5429extern float __attribute__((const, overloadable))
5430 native_tanpi(float v);
5431#endif
5432
5433#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5434extern float2 __attribute__((const, overloadable))
5435 native_tanpi(float2 v);
5436#endif
5437
5438#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5439extern float3 __attribute__((const, overloadable))
5440 native_tanpi(float3 v);
5441#endif
5442
5443#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5444extern float4 __attribute__((const, overloadable))
5445 native_tanpi(float4 v);
5446#endif
5447
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005448#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005449extern half __attribute__((const, overloadable))
5450 native_tanpi(half v);
5451#endif
5452
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005453#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005454extern half2 __attribute__((const, overloadable))
5455 native_tanpi(half2 v);
5456#endif
5457
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005458#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005459extern half3 __attribute__((const, overloadable))
5460 native_tanpi(half3 v);
5461#endif
5462
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005463#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005464extern half4 __attribute__((const, overloadable))
5465 native_tanpi(half4 v);
5466#endif
5467
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005468/*
5469 * nextafter: Next floating point number
5470 *
5471 * Returns the next representable floating point number from v towards target.
5472 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005473 * In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
5474 * value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005475 */
5476extern float __attribute__((const, overloadable))
5477 nextafter(float v, float target);
5478
5479extern float2 __attribute__((const, overloadable))
5480 nextafter(float2 v, float2 target);
5481
5482extern float3 __attribute__((const, overloadable))
5483 nextafter(float3 v, float3 target);
5484
5485extern float4 __attribute__((const, overloadable))
5486 nextafter(float4 v, float4 target);
5487
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005488#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08005489extern half __attribute__((const, overloadable))
5490 nextafter(half v, half target);
5491#endif
5492
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005493#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08005494extern half2 __attribute__((const, overloadable))
5495 nextafter(half2 v, half2 target);
5496#endif
5497
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005498#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08005499extern half3 __attribute__((const, overloadable))
5500 nextafter(half3 v, half3 target);
5501#endif
5502
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005503#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainarf86ea3f2016-02-04 11:41:09 -08005504extern half4 __attribute__((const, overloadable))
5505 nextafter(half4 v, half4 target);
5506#endif
5507
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005508/*
5509 * pow: Base raised to an exponent
5510 *
5511 * Returns base raised to the power exponent, i.e. base ^ exponent.
5512 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005513 * pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the
5514 * base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005515 */
5516extern float __attribute__((const, overloadable))
5517 pow(float base, float exponent);
5518
5519extern float2 __attribute__((const, overloadable))
5520 pow(float2 base, float2 exponent);
5521
5522extern float3 __attribute__((const, overloadable))
5523 pow(float3 base, float3 exponent);
5524
5525extern float4 __attribute__((const, overloadable))
5526 pow(float4 base, float4 exponent);
5527
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005528#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005529extern half __attribute__((const, overloadable))
5530 pow(half base, half exponent);
5531#endif
5532
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005533#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005534extern half2 __attribute__((const, overloadable))
5535 pow(half2 base, half2 exponent);
5536#endif
5537
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005538#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005539extern half3 __attribute__((const, overloadable))
5540 pow(half3 base, half3 exponent);
5541#endif
5542
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005543#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005544extern half4 __attribute__((const, overloadable))
5545 pow(half4 base, half4 exponent);
5546#endif
5547
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005548/*
5549 * pown: Base raised to an integer exponent
5550 *
5551 * Returns base raised to the power exponent, i.e. base ^ exponent.
5552 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005553 * pow() and powr() are similar. The both take a float exponent. powr() also assumes the
5554 * base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005555 */
5556extern float __attribute__((const, overloadable))
5557 pown(float base, int exponent);
5558
5559extern float2 __attribute__((const, overloadable))
5560 pown(float2 base, int2 exponent);
5561
5562extern float3 __attribute__((const, overloadable))
5563 pown(float3 base, int3 exponent);
5564
5565extern float4 __attribute__((const, overloadable))
5566 pown(float4 base, int4 exponent);
5567
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005568#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005569extern half __attribute__((const, overloadable))
5570 pown(half base, int exponent);
5571#endif
5572
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005573#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005574extern half2 __attribute__((const, overloadable))
5575 pown(half2 base, int2 exponent);
5576#endif
5577
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005578#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005579extern half3 __attribute__((const, overloadable))
5580 pown(half3 base, int3 exponent);
5581#endif
5582
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005583#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005584extern half4 __attribute__((const, overloadable))
5585 pown(half4 base, int4 exponent);
5586#endif
5587
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005588/*
5589 * powr: Positive base raised to an exponent
5590 *
5591 * Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0.
5592 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005593 * pow() and pown() are similar. They both make no assumptions about the base.
5594 * pow() takes a float exponent while pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005595 *
5596 * See also native_powr().
5597 */
5598extern float __attribute__((const, overloadable))
5599 powr(float base, float exponent);
5600
5601extern float2 __attribute__((const, overloadable))
5602 powr(float2 base, float2 exponent);
5603
5604extern float3 __attribute__((const, overloadable))
5605 powr(float3 base, float3 exponent);
5606
5607extern float4 __attribute__((const, overloadable))
5608 powr(float4 base, float4 exponent);
5609
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005610#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005611extern half __attribute__((const, overloadable))
5612 powr(half base, half exponent);
5613#endif
5614
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005615#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005616extern half2 __attribute__((const, overloadable))
5617 powr(half2 base, half2 exponent);
5618#endif
5619
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005620#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005621extern half3 __attribute__((const, overloadable))
5622 powr(half3 base, half3 exponent);
5623#endif
5624
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005625#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005626extern half4 __attribute__((const, overloadable))
5627 powr(half4 base, half4 exponent);
5628#endif
5629
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005630/*
5631 * radians: Converts degrees into radians
5632 *
5633 * Converts from degrees to radians.
5634 */
5635extern float __attribute__((const, overloadable))
5636 radians(float v);
5637
5638extern float2 __attribute__((const, overloadable))
5639 radians(float2 v);
5640
5641extern float3 __attribute__((const, overloadable))
5642 radians(float3 v);
5643
5644extern float4 __attribute__((const, overloadable))
5645 radians(float4 v);
5646
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005647#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005648extern half __attribute__((const, overloadable))
5649 radians(half v);
5650#endif
5651
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005652#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005653extern half2 __attribute__((const, overloadable))
5654 radians(half2 v);
5655#endif
5656
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005657#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005658extern half3 __attribute__((const, overloadable))
5659 radians(half3 v);
5660#endif
5661
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005662#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005663extern half4 __attribute__((const, overloadable))
5664 radians(half4 v);
5665#endif
5666
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005667/*
5668 * remainder: Remainder of a division
5669 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005670 * Returns the remainder of (numerator / denominator), where the quotient is rounded towards
5671 * the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005672 *
5673 * The function fmod() is similar but rounds toward the closest interger.
5674 * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
5675 * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
5676 */
5677extern float __attribute__((const, overloadable))
5678 remainder(float numerator, float denominator);
5679
5680extern float2 __attribute__((const, overloadable))
5681 remainder(float2 numerator, float2 denominator);
5682
5683extern float3 __attribute__((const, overloadable))
5684 remainder(float3 numerator, float3 denominator);
5685
5686extern float4 __attribute__((const, overloadable))
5687 remainder(float4 numerator, float4 denominator);
5688
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005689#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005690extern half __attribute__((const, overloadable))
5691 remainder(half numerator, half denominator);
5692#endif
5693
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005694#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005695extern half2 __attribute__((const, overloadable))
5696 remainder(half2 numerator, half2 denominator);
5697#endif
5698
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005699#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005700extern half3 __attribute__((const, overloadable))
5701 remainder(half3 numerator, half3 denominator);
5702#endif
5703
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005704#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005705extern half4 __attribute__((const, overloadable))
5706 remainder(half4 numerator, half4 denominator);
5707#endif
5708
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005709/*
5710 * remquo: Remainder and quotient of a division
5711 *
5712 * Returns the quotient and the remainder of (numerator / denominator).
5713 *
5714 * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
5715 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005716 * This function is useful for implementing periodic functions. The low three bits of the
5717 * quotient gives the quadrant and the remainder the distance within the quadrant.
5718 * For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant)
5719 * to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005720 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005721 * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3
5722 * and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005723 *
5724 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005725 * numerator: Numerator.
5726 * denominator: Denominator.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07005727 * quotient: *quotient will be set to the integer quotient.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005728 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005729 * Returns: Remainder, precise only for the low three bits.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005730 */
5731extern float __attribute__((overloadable))
5732 remquo(float numerator, float denominator, int* quotient);
5733
5734extern float2 __attribute__((overloadable))
5735 remquo(float2 numerator, float2 denominator, int2* quotient);
5736
5737extern float3 __attribute__((overloadable))
5738 remquo(float3 numerator, float3 denominator, int3* quotient);
5739
5740extern float4 __attribute__((overloadable))
5741 remquo(float4 numerator, float4 denominator, int4* quotient);
5742
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005743#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005744extern half __attribute__((overloadable))
5745 remquo(half numerator, half denominator, int* quotient);
5746#endif
5747
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005748#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005749extern half2 __attribute__((overloadable))
5750 remquo(half2 numerator, half2 denominator, int2* quotient);
5751#endif
5752
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005753#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005754extern half3 __attribute__((overloadable))
5755 remquo(half3 numerator, half3 denominator, int3* quotient);
5756#endif
5757
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005758#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005759extern half4 __attribute__((overloadable))
5760 remquo(half4 numerator, half4 denominator, int4* quotient);
5761#endif
5762
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005763/*
5764 * rint: Round to even
5765 *
5766 * Rounds to the nearest integral value.
5767 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005768 * rint() rounds half values to even. For example, rint(0.5f) returns 0.f and
5769 * rint(1.5f) returns 2.f. Similarly, rint(-0.5f) returns -0.f and
5770 * rint(-1.5f) returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005771 *
5772 * round() is similar but rounds away from zero. trunc() truncates the decimal fraction.
5773 */
5774extern float __attribute__((const, overloadable))
5775 rint(float v);
5776
5777extern float2 __attribute__((const, overloadable))
5778 rint(float2 v);
5779
5780extern float3 __attribute__((const, overloadable))
5781 rint(float3 v);
5782
5783extern float4 __attribute__((const, overloadable))
5784 rint(float4 v);
5785
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005786#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005787extern half __attribute__((const, overloadable))
5788 rint(half v);
5789#endif
5790
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005791#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005792extern half2 __attribute__((const, overloadable))
5793 rint(half2 v);
5794#endif
5795
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005796#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005797extern half3 __attribute__((const, overloadable))
5798 rint(half3 v);
5799#endif
5800
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005801#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005802extern half4 __attribute__((const, overloadable))
5803 rint(half4 v);
5804#endif
5805
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005806/*
5807 * rootn: Nth root
5808 *
5809 * Compute the Nth root of a value.
5810 *
5811 * See also native_rootn().
5812 */
5813extern float __attribute__((const, overloadable))
5814 rootn(float v, int n);
5815
5816extern float2 __attribute__((const, overloadable))
5817 rootn(float2 v, int2 n);
5818
5819extern float3 __attribute__((const, overloadable))
5820 rootn(float3 v, int3 n);
5821
5822extern float4 __attribute__((const, overloadable))
5823 rootn(float4 v, int4 n);
5824
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005825#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005826extern half __attribute__((const, overloadable))
5827 rootn(half v, int n);
5828#endif
5829
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005830#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005831extern half2 __attribute__((const, overloadable))
5832 rootn(half2 v, int2 n);
5833#endif
5834
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005835#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005836extern half3 __attribute__((const, overloadable))
5837 rootn(half3 v, int3 n);
5838#endif
5839
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005840#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005841extern half4 __attribute__((const, overloadable))
5842 rootn(half4 v, int4 n);
5843#endif
5844
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005845/*
5846 * round: Round away from zero
5847 *
5848 * Round to the nearest integral value.
5849 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005850 * round() rounds half values away from zero. For example, round(0.5f) returns 1.f
5851 * and round(1.5f) returns 2.f. Similarly, round(-0.5f) returns -1.f
5852 * and round(-1.5f) returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005853 *
5854 * rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction.
5855 */
5856extern float __attribute__((const, overloadable))
5857 round(float v);
5858
5859extern float2 __attribute__((const, overloadable))
5860 round(float2 v);
5861
5862extern float3 __attribute__((const, overloadable))
5863 round(float3 v);
5864
5865extern float4 __attribute__((const, overloadable))
5866 round(float4 v);
5867
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005868#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005869extern half __attribute__((const, overloadable))
5870 round(half v);
5871#endif
5872
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005873#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005874extern half2 __attribute__((const, overloadable))
5875 round(half2 v);
5876#endif
5877
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005878#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005879extern half3 __attribute__((const, overloadable))
5880 round(half3 v);
5881#endif
5882
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005883#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005884extern half4 __attribute__((const, overloadable))
5885 round(half4 v);
5886#endif
5887
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005888/*
5889 * rsqrt: Reciprocal of a square root
5890 *
5891 * Returns (1 / sqrt(v)).
5892 *
5893 * See also half_rsqrt(), native_rsqrt().
5894 */
5895extern float __attribute__((const, overloadable))
5896 rsqrt(float v);
5897
5898extern float2 __attribute__((const, overloadable))
5899 rsqrt(float2 v);
5900
5901extern float3 __attribute__((const, overloadable))
5902 rsqrt(float3 v);
5903
5904extern float4 __attribute__((const, overloadable))
5905 rsqrt(float4 v);
5906
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005907#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005908extern half __attribute__((const, overloadable))
5909 rsqrt(half v);
5910#endif
5911
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005912#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005913extern half2 __attribute__((const, overloadable))
5914 rsqrt(half2 v);
5915#endif
5916
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005917#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005918extern half3 __attribute__((const, overloadable))
5919 rsqrt(half3 v);
5920#endif
5921
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005922#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005923extern half4 __attribute__((const, overloadable))
5924 rsqrt(half4 v);
5925#endif
5926
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005927/*
5928 * sign: Sign of a value
5929 *
5930 * Returns the sign of a value.
5931 *
5932 * if (v < 0) return -1.f;
5933 * else if (v > 0) return 1.f;
5934 * else return 0.f;
5935 */
5936extern float __attribute__((const, overloadable))
5937 sign(float v);
5938
5939extern float2 __attribute__((const, overloadable))
5940 sign(float2 v);
5941
5942extern float3 __attribute__((const, overloadable))
5943 sign(float3 v);
5944
5945extern float4 __attribute__((const, overloadable))
5946 sign(float4 v);
5947
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005948#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005949extern half __attribute__((const, overloadable))
5950 sign(half v);
5951#endif
5952
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005953#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005954extern half2 __attribute__((const, overloadable))
5955 sign(half2 v);
5956#endif
5957
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005958#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005959extern half3 __attribute__((const, overloadable))
5960 sign(half3 v);
5961#endif
5962
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005963#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005964extern half4 __attribute__((const, overloadable))
5965 sign(half4 v);
5966#endif
5967
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005968/*
5969 * sin: Sine
5970 *
5971 * Returns the sine of an angle measured in radians.
5972 *
5973 * See also native_sin().
5974 */
5975extern float __attribute__((const, overloadable))
5976 sin(float v);
5977
5978extern float2 __attribute__((const, overloadable))
5979 sin(float2 v);
5980
5981extern float3 __attribute__((const, overloadable))
5982 sin(float3 v);
5983
5984extern float4 __attribute__((const, overloadable))
5985 sin(float4 v);
5986
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005987#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005988extern half __attribute__((const, overloadable))
5989 sin(half v);
5990#endif
5991
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005992#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005993extern half2 __attribute__((const, overloadable))
5994 sin(half2 v);
5995#endif
5996
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08005997#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005998extern half3 __attribute__((const, overloadable))
5999 sin(half3 v);
6000#endif
6001
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006002#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006003extern half4 __attribute__((const, overloadable))
6004 sin(half4 v);
6005#endif
6006
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006007/*
6008 * sincos: Sine and cosine
6009 *
6010 * Returns the sine and cosine of a value.
6011 *
6012 * See also native_sincos().
6013 *
6014 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07006015 * v: Incoming value in radians.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07006016 * cos: *cos will be set to the cosine value.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006017 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07006018 * Returns: Sine of v.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006019 */
6020extern float __attribute__((overloadable))
6021 sincos(float v, float* cos);
6022
6023extern float2 __attribute__((overloadable))
6024 sincos(float2 v, float2* cos);
6025
6026extern float3 __attribute__((overloadable))
6027 sincos(float3 v, float3* cos);
6028
6029extern float4 __attribute__((overloadable))
6030 sincos(float4 v, float4* cos);
6031
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006032#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006033extern half __attribute__((overloadable))
6034 sincos(half v, half* cos);
6035#endif
6036
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006037#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006038extern half2 __attribute__((overloadable))
6039 sincos(half2 v, half2* cos);
6040#endif
6041
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006042#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006043extern half3 __attribute__((overloadable))
6044 sincos(half3 v, half3* cos);
6045#endif
6046
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006047#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006048extern half4 __attribute__((overloadable))
6049 sincos(half4 v, half4* cos);
6050#endif
6051
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006052/*
6053 * sinh: Hyperbolic sine
6054 *
6055 * Returns the hyperbolic sine of v, where v is measured in radians.
6056 *
6057 * See also native_sinh().
6058 */
6059extern float __attribute__((const, overloadable))
6060 sinh(float v);
6061
6062extern float2 __attribute__((const, overloadable))
6063 sinh(float2 v);
6064
6065extern float3 __attribute__((const, overloadable))
6066 sinh(float3 v);
6067
6068extern float4 __attribute__((const, overloadable))
6069 sinh(float4 v);
6070
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006071#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006072extern half __attribute__((const, overloadable))
6073 sinh(half v);
6074#endif
6075
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006076#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006077extern half2 __attribute__((const, overloadable))
6078 sinh(half2 v);
6079#endif
6080
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006081#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006082extern half3 __attribute__((const, overloadable))
6083 sinh(half3 v);
6084#endif
6085
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006086#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006087extern half4 __attribute__((const, overloadable))
6088 sinh(half4 v);
6089#endif
6090
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006091/*
6092 * sinpi: Sine of a number multiplied by pi
6093 *
6094 * Returns the sine of (v * pi), where (v * pi) is measured in radians.
6095 *
6096 * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
6097 *
6098 * See also native_sinpi().
6099 */
6100extern float __attribute__((const, overloadable))
6101 sinpi(float v);
6102
6103extern float2 __attribute__((const, overloadable))
6104 sinpi(float2 v);
6105
6106extern float3 __attribute__((const, overloadable))
6107 sinpi(float3 v);
6108
6109extern float4 __attribute__((const, overloadable))
6110 sinpi(float4 v);
6111
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006112#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006113extern half __attribute__((const, overloadable))
6114 sinpi(half v);
6115#endif
6116
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006117#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006118extern half2 __attribute__((const, overloadable))
6119 sinpi(half2 v);
6120#endif
6121
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006122#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006123extern half3 __attribute__((const, overloadable))
6124 sinpi(half3 v);
6125#endif
6126
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006127#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006128extern half4 __attribute__((const, overloadable))
6129 sinpi(half4 v);
6130#endif
6131
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006132/*
6133 * sqrt: Square root
6134 *
6135 * Returns the square root of a value.
6136 *
6137 * See also half_sqrt(), native_sqrt().
6138 */
6139extern float __attribute__((const, overloadable))
6140 sqrt(float v);
6141
6142extern float2 __attribute__((const, overloadable))
6143 sqrt(float2 v);
6144
6145extern float3 __attribute__((const, overloadable))
6146 sqrt(float3 v);
6147
6148extern float4 __attribute__((const, overloadable))
6149 sqrt(float4 v);
6150
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006151#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006152extern half __attribute__((const, overloadable))
6153 sqrt(half v);
6154#endif
6155
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006156#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006157extern half2 __attribute__((const, overloadable))
6158 sqrt(half2 v);
6159#endif
6160
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006161#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006162extern half3 __attribute__((const, overloadable))
6163 sqrt(half3 v);
6164#endif
6165
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006166#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006167extern half4 __attribute__((const, overloadable))
6168 sqrt(half4 v);
6169#endif
6170
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006171/*
6172 * step: 0 if less than a value, 0 otherwise
6173 *
6174 * Returns 0.f if v < edge, 1.f otherwise.
6175 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07006176 * This can be useful to create conditional computations without using loops and branching
6177 * instructions. For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i])
6178 * for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006179 */
6180extern float __attribute__((const, overloadable))
6181 step(float edge, float v);
6182
6183extern float2 __attribute__((const, overloadable))
6184 step(float2 edge, float2 v);
6185
6186extern float3 __attribute__((const, overloadable))
6187 step(float3 edge, float3 v);
6188
6189extern float4 __attribute__((const, overloadable))
6190 step(float4 edge, float4 v);
6191
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006192#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006193extern half __attribute__((const, overloadable))
6194 step(half edge, half v);
6195#endif
6196
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006197#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006198extern half2 __attribute__((const, overloadable))
6199 step(half2 edge, half2 v);
6200#endif
6201
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006202#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006203extern half3 __attribute__((const, overloadable))
6204 step(half3 edge, half3 v);
6205#endif
6206
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006207#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006208extern half4 __attribute__((const, overloadable))
6209 step(half4 edge, half4 v);
6210#endif
6211
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006212extern float2 __attribute__((const, overloadable))
6213 step(float2 edge, float v);
6214
6215extern float3 __attribute__((const, overloadable))
6216 step(float3 edge, float v);
6217
6218extern float4 __attribute__((const, overloadable))
6219 step(float4 edge, float v);
6220
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006221#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006222extern half2 __attribute__((const, overloadable))
6223 step(half2 edge, half v);
6224#endif
6225
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006226#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006227extern half3 __attribute__((const, overloadable))
6228 step(half3 edge, half v);
6229#endif
6230
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006231#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006232extern half4 __attribute__((const, overloadable))
6233 step(half4 edge, half v);
6234#endif
6235
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006236#if (defined(RS_VERSION) && (RS_VERSION >= 21))
6237extern float2 __attribute__((const, overloadable))
6238 step(float edge, float2 v);
6239#endif
6240
6241#if (defined(RS_VERSION) && (RS_VERSION >= 21))
6242extern float3 __attribute__((const, overloadable))
6243 step(float edge, float3 v);
6244#endif
6245
6246#if (defined(RS_VERSION) && (RS_VERSION >= 21))
6247extern float4 __attribute__((const, overloadable))
6248 step(float edge, float4 v);
6249#endif
6250
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006251#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006252extern half2 __attribute__((const, overloadable))
6253 step(half edge, half2 v);
6254#endif
6255
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006256#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006257extern half3 __attribute__((const, overloadable))
6258 step(half edge, half3 v);
6259#endif
6260
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006261#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006262extern half4 __attribute__((const, overloadable))
6263 step(half edge, half4 v);
6264#endif
6265
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006266/*
6267 * tan: Tangent
6268 *
6269 * Returns the tangent of an angle measured in radians.
6270 *
6271 * See also native_tan().
6272 */
6273extern float __attribute__((const, overloadable))
6274 tan(float v);
6275
6276extern float2 __attribute__((const, overloadable))
6277 tan(float2 v);
6278
6279extern float3 __attribute__((const, overloadable))
6280 tan(float3 v);
6281
6282extern float4 __attribute__((const, overloadable))
6283 tan(float4 v);
6284
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006285#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006286extern half __attribute__((const, overloadable))
6287 tan(half v);
6288#endif
6289
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006290#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006291extern half2 __attribute__((const, overloadable))
6292 tan(half2 v);
6293#endif
6294
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006295#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006296extern half3 __attribute__((const, overloadable))
6297 tan(half3 v);
6298#endif
6299
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006300#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006301extern half4 __attribute__((const, overloadable))
6302 tan(half4 v);
6303#endif
6304
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006305/*
6306 * tanh: Hyperbolic tangent
6307 *
6308 * Returns the hyperbolic tangent of a value.
6309 *
6310 * See also native_tanh().
6311 */
6312extern float __attribute__((const, overloadable))
6313 tanh(float v);
6314
6315extern float2 __attribute__((const, overloadable))
6316 tanh(float2 v);
6317
6318extern float3 __attribute__((const, overloadable))
6319 tanh(float3 v);
6320
6321extern float4 __attribute__((const, overloadable))
6322 tanh(float4 v);
6323
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006324#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006325extern half __attribute__((const, overloadable))
6326 tanh(half v);
6327#endif
6328
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006329#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006330extern half2 __attribute__((const, overloadable))
6331 tanh(half2 v);
6332#endif
6333
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006334#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006335extern half3 __attribute__((const, overloadable))
6336 tanh(half3 v);
6337#endif
6338
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006339#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006340extern half4 __attribute__((const, overloadable))
6341 tanh(half4 v);
6342#endif
6343
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006344/*
6345 * tanpi: Tangent of a number multiplied by pi
6346 *
6347 * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
6348 *
6349 * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
6350 *
6351 * See also native_tanpi().
6352 */
6353extern float __attribute__((const, overloadable))
6354 tanpi(float v);
6355
6356extern float2 __attribute__((const, overloadable))
6357 tanpi(float2 v);
6358
6359extern float3 __attribute__((const, overloadable))
6360 tanpi(float3 v);
6361
6362extern float4 __attribute__((const, overloadable))
6363 tanpi(float4 v);
6364
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006365#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006366extern half __attribute__((const, overloadable))
6367 tanpi(half v);
6368#endif
6369
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006370#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006371extern half2 __attribute__((const, overloadable))
6372 tanpi(half2 v);
6373#endif
6374
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006375#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006376extern half3 __attribute__((const, overloadable))
6377 tanpi(half3 v);
6378#endif
6379
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006380#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006381extern half4 __attribute__((const, overloadable))
6382 tanpi(half4 v);
6383#endif
6384
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006385/*
6386 * tgamma: Gamma function
6387 *
6388 * Returns the gamma function of a value.
6389 *
6390 * See also lgamma().
6391 */
6392extern float __attribute__((const, overloadable))
6393 tgamma(float v);
6394
6395extern float2 __attribute__((const, overloadable))
6396 tgamma(float2 v);
6397
6398extern float3 __attribute__((const, overloadable))
6399 tgamma(float3 v);
6400
6401extern float4 __attribute__((const, overloadable))
6402 tgamma(float4 v);
6403
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006404#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006405extern half __attribute__((const, overloadable))
6406 tgamma(half v);
6407#endif
6408
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006409#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006410extern half2 __attribute__((const, overloadable))
6411 tgamma(half2 v);
6412#endif
6413
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006414#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006415extern half3 __attribute__((const, overloadable))
6416 tgamma(half3 v);
6417#endif
6418
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006419#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006420extern half4 __attribute__((const, overloadable))
6421 tgamma(half4 v);
6422#endif
6423
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006424/*
6425 * trunc: Truncates a floating point
6426 *
6427 * Rounds to integral using truncation.
6428 *
6429 * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
6430 *
6431 * See rint() and round() for other rounding options.
6432 */
6433extern float __attribute__((const, overloadable))
6434 trunc(float v);
6435
6436extern float2 __attribute__((const, overloadable))
6437 trunc(float2 v);
6438
6439extern float3 __attribute__((const, overloadable))
6440 trunc(float3 v);
6441
6442extern float4 __attribute__((const, overloadable))
6443 trunc(float4 v);
6444
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006445#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006446extern half __attribute__((const, overloadable))
6447 trunc(half v);
6448#endif
6449
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006450#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006451extern half2 __attribute__((const, overloadable))
6452 trunc(half2 v);
6453#endif
6454
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006455#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006456extern half3 __attribute__((const, overloadable))
6457 trunc(half3 v);
6458#endif
6459
Pirama Arumuga Nainar738ee872016-02-18 14:48:02 -08006460#if (defined(RS_VERSION) && (RS_VERSION >= 24))
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006461extern half4 __attribute__((const, overloadable))
6462 trunc(half4 v);
6463#endif
6464
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006465/*
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006466 * rsClamp: Restrain a value to a range
Jason Sams9df3b2b2011-08-08 14:31:25 -07006467 *
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006468 * DEPRECATED. Do not use.
Jason Sams044e2ee2011-08-08 16:52:30 -07006469 *
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006470 * Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006471 *
6472 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07006473 * amount: Value to clamp.
6474 * low: Lower bound.
6475 * high: Upper bound.
Jason Sams9df3b2b2011-08-08 14:31:25 -07006476 */
Verena Beckhama4d25bc2015-11-12 14:20:31 +00006477extern char __attribute__((const, overloadable
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006478#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6479, deprecated("Use clamp() instead.")
6480#endif
6481))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006482 rsClamp(char amount, char low, char high);
Jason Sams044e2ee2011-08-08 16:52:30 -07006483
Verena Beckhama4d25bc2015-11-12 14:20:31 +00006484extern uchar __attribute__((const, overloadable
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006485#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6486, deprecated("Use clamp() instead.")
6487#endif
6488))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006489 rsClamp(uchar amount, uchar low, uchar high);
Jason Samsc61346b2010-05-28 18:23:22 -07006490
Verena Beckhama4d25bc2015-11-12 14:20:31 +00006491extern short __attribute__((const, overloadable
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006492#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6493, deprecated("Use clamp() instead.")
6494#endif
6495))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006496 rsClamp(short amount, short low, short high);
Jason Samse1eb6152011-06-21 16:42:30 -07006497
Verena Beckhama4d25bc2015-11-12 14:20:31 +00006498extern ushort __attribute__((const, overloadable
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006499#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6500, deprecated("Use clamp() instead.")
6501#endif
6502))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006503 rsClamp(ushort amount, ushort low, ushort high);
6504
Verena Beckhama4d25bc2015-11-12 14:20:31 +00006505extern int __attribute__((const, overloadable
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006506#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6507, deprecated("Use clamp() instead.")
6508#endif
6509))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006510 rsClamp(int amount, int low, int high);
6511
Verena Beckhama4d25bc2015-11-12 14:20:31 +00006512extern uint __attribute__((const, overloadable
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006513#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6514, deprecated("Use clamp() instead.")
6515#endif
6516))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006517 rsClamp(uint amount, uint low, uint high);
6518
6519/*
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006520 * rsFrac: Returns the fractional part of a float
6521 *
6522 * DEPRECATED. Do not use.
6523 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006524 * Returns the fractional part of a float
Jason Samse1eb6152011-06-21 16:42:30 -07006525 */
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006526extern float __attribute__((const, overloadable
6527#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6528, deprecated("Use fract() instead.")
6529#endif
6530))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006531 rsFrac(float v);
Jason Sams044e2ee2011-08-08 16:52:30 -07006532
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006533/*
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006534 * rsRand: Pseudo-random number
6535 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006536 * Return a random value between 0 (or min_value) and max_malue.
Jason Samse1eb6152011-06-21 16:42:30 -07006537 */
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006538extern int __attribute__((overloadable))
6539 rsRand(int max_value);
Jason Samse1eb6152011-06-21 16:42:30 -07006540
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006541extern int __attribute__((overloadable))
6542 rsRand(int min_value, int max_value);
Jason Samse1eb6152011-06-21 16:42:30 -07006543
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006544extern float __attribute__((overloadable))
6545 rsRand(float max_value);
Jason Samse1eb6152011-06-21 16:42:30 -07006546
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006547extern float __attribute__((overloadable))
6548 rsRand(float min_value, float max_value);
6549
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006550#endif // RENDERSCRIPT_RS_MATH_RSH