blob: 1a513168087b3535b9f4fa94249817581b3ab464 [file] [log] [blame]
Jason Sams044e2ee2011-08-08 16:52:30 -07001/*
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07002 * Copyright (C) 2015 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 Nainar586539c2015-12-09 15:56:03 -0800218#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
219extern half __attribute__((const, overloadable))
220 acos(half v);
221#endif
222
223#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
224extern half2 __attribute__((const, overloadable))
225 acos(half2 v);
226#endif
227
228#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
229extern half3 __attribute__((const, overloadable))
230 acos(half3 v);
231#endif
232
233#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
234extern 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 Nainar586539c2015-12-09 15:56:03 -0800257#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
258extern half __attribute__((const, overloadable))
259 acosh(half v);
260#endif
261
262#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
263extern half2 __attribute__((const, overloadable))
264 acosh(half2 v);
265#endif
266
267#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
268extern half3 __attribute__((const, overloadable))
269 acosh(half3 v);
270#endif
271
272#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
273extern 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 Nainar586539c2015-12-09 15:56:03 -0800298#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
299extern half __attribute__((const, overloadable))
300 acospi(half v);
301#endif
302
303#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
304extern half2 __attribute__((const, overloadable))
305 acospi(half2 v);
306#endif
307
308#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
309extern half3 __attribute__((const, overloadable))
310 acospi(half3 v);
311#endif
312
313#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
314extern 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 Nainar586539c2015-12-09 15:56:03 -0800337#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
338extern half __attribute__((const, overloadable))
339 asin(half v);
340#endif
341
342#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
343extern half2 __attribute__((const, overloadable))
344 asin(half2 v);
345#endif
346
347#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
348extern half3 __attribute__((const, overloadable))
349 asin(half3 v);
350#endif
351
352#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
353extern 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 Nainar586539c2015-12-09 15:56:03 -0800376#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
377extern half __attribute__((const, overloadable))
378 asinh(half v);
379#endif
380
381#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
382extern half2 __attribute__((const, overloadable))
383 asinh(half2 v);
384#endif
385
386#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
387extern half3 __attribute__((const, overloadable))
388 asinh(half3 v);
389#endif
390
391#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
392extern 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 Nainar586539c2015-12-09 15:56:03 -0800417#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
418extern half __attribute__((const, overloadable))
419 asinpi(half v);
420#endif
421
422#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
423extern half2 __attribute__((const, overloadable))
424 asinpi(half2 v);
425#endif
426
427#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
428extern half3 __attribute__((const, overloadable))
429 asinpi(half3 v);
430#endif
431
432#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
433extern 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 Nainar586539c2015-12-09 15:56:03 -0800456#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
457extern half __attribute__((const, overloadable))
458 atan(half v);
459#endif
460
461#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
462extern half2 __attribute__((const, overloadable))
463 atan(half2 v);
464#endif
465
466#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
467extern half3 __attribute__((const, overloadable))
468 atan(half3 v);
469#endif
470
471#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
472extern 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 Nainar586539c2015-12-09 15:56:03 -0800499#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
500extern half __attribute__((const, overloadable))
501 atan2(half numerator, half denominator);
502#endif
503
504#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
505extern half2 __attribute__((const, overloadable))
506 atan2(half2 numerator, half2 denominator);
507#endif
508
509#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
510extern half3 __attribute__((const, overloadable))
511 atan2(half3 numerator, half3 denominator);
512#endif
513
514#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
515extern 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 Nainar586539c2015-12-09 15:56:03 -0800544#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
545extern half __attribute__((const, overloadable))
546 atan2pi(half numerator, half denominator);
547#endif
548
549#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
550extern half2 __attribute__((const, overloadable))
551 atan2pi(half2 numerator, half2 denominator);
552#endif
553
554#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
555extern half3 __attribute__((const, overloadable))
556 atan2pi(half3 numerator, half3 denominator);
557#endif
558
559#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
560extern 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 Nainar586539c2015-12-09 15:56:03 -0800583#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
584extern half __attribute__((const, overloadable))
585 atanh(half v);
586#endif
587
588#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
589extern half2 __attribute__((const, overloadable))
590 atanh(half2 v);
591#endif
592
593#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
594extern half3 __attribute__((const, overloadable))
595 atanh(half3 v);
596#endif
597
598#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
599extern 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 Nainar586539c2015-12-09 15:56:03 -0800624#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
625extern half __attribute__((const, overloadable))
626 atanpi(half v);
627#endif
628
629#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
630extern half2 __attribute__((const, overloadable))
631 atanpi(half2 v);
632#endif
633
634#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
635extern half3 __attribute__((const, overloadable))
636 atanpi(half3 v);
637#endif
638
639#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
640extern 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 Nainar586539c2015-12-09 15:56:03 -0800663#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
664extern half __attribute__((const, overloadable))
665 cbrt(half v);
666#endif
667
668#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
669extern half2 __attribute__((const, overloadable))
670 cbrt(half2 v);
671#endif
672
673#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
674extern half3 __attribute__((const, overloadable))
675 cbrt(half3 v);
676#endif
677
678#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
679extern 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 Nainar586539c2015-12-09 15:56:03 -0800704#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
705extern half __attribute__((const, overloadable))
706 ceil(half v);
707#endif
708
709#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
710extern half2 __attribute__((const, overloadable))
711 ceil(half2 v);
712#endif
713
714#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
715extern half3 __attribute__((const, overloadable))
716 ceil(half3 v);
717#endif
718
719#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
720extern 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 Nainar586539c2015-12-09 15:56:03 -08001041#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1042extern half __attribute__((const, overloadable))
1043 clamp(half value, half min_value, half max_value);
1044#endif
1045
1046#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1047extern half2 __attribute__((const, overloadable))
1048 clamp(half2 value, half2 min_value, half2 max_value);
1049#endif
1050
1051#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1052extern half3 __attribute__((const, overloadable))
1053 clamp(half3 value, half3 min_value, half3 max_value);
1054#endif
1055
1056#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1057extern half4 __attribute__((const, overloadable))
1058 clamp(half4 value, half4 min_value, half4 max_value);
1059#endif
1060
1061#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1062extern half2 __attribute__((const, overloadable))
1063 clamp(half2 value, half min_value, half max_value);
1064#endif
1065
1066#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1067extern half3 __attribute__((const, overloadable))
1068 clamp(half3 value, half min_value, half max_value);
1069#endif
1070
1071#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1072extern 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
1176/*
1177 * cos: Cosine
1178 *
1179 * Returns the cosine of an angle measured in radians.
1180 *
1181 * See also native_cos().
1182 */
1183extern float __attribute__((const, overloadable))
1184 cos(float v);
1185
1186extern float2 __attribute__((const, overloadable))
1187 cos(float2 v);
1188
1189extern float3 __attribute__((const, overloadable))
1190 cos(float3 v);
1191
1192extern float4 __attribute__((const, overloadable))
1193 cos(float4 v);
1194
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001195#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1196extern half __attribute__((const, overloadable))
1197 cos(half v);
1198#endif
1199
1200#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1201extern half2 __attribute__((const, overloadable))
1202 cos(half2 v);
1203#endif
1204
1205#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1206extern half3 __attribute__((const, overloadable))
1207 cos(half3 v);
1208#endif
1209
1210#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1211extern half4 __attribute__((const, overloadable))
1212 cos(half4 v);
1213#endif
1214
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001215/*
1216 * cosh: Hypebolic cosine
1217 *
1218 * Returns the hypebolic cosine of v, where v is measured in radians.
1219 *
1220 * See also native_cosh().
1221 */
1222extern float __attribute__((const, overloadable))
1223 cosh(float v);
1224
1225extern float2 __attribute__((const, overloadable))
1226 cosh(float2 v);
1227
1228extern float3 __attribute__((const, overloadable))
1229 cosh(float3 v);
1230
1231extern float4 __attribute__((const, overloadable))
1232 cosh(float4 v);
1233
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001234#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1235extern half __attribute__((const, overloadable))
1236 cosh(half v);
1237#endif
1238
1239#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1240extern half2 __attribute__((const, overloadable))
1241 cosh(half2 v);
1242#endif
1243
1244#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1245extern half3 __attribute__((const, overloadable))
1246 cosh(half3 v);
1247#endif
1248
1249#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1250extern half4 __attribute__((const, overloadable))
1251 cosh(half4 v);
1252#endif
1253
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001254/*
1255 * cospi: Cosine of a number multiplied by pi
1256 *
1257 * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
1258 *
1259 * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
1260 *
1261 * See also native_cospi().
1262 */
1263extern float __attribute__((const, overloadable))
1264 cospi(float v);
1265
1266extern float2 __attribute__((const, overloadable))
1267 cospi(float2 v);
1268
1269extern float3 __attribute__((const, overloadable))
1270 cospi(float3 v);
1271
1272extern float4 __attribute__((const, overloadable))
1273 cospi(float4 v);
1274
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001275#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1276extern half __attribute__((const, overloadable))
1277 cospi(half v);
1278#endif
1279
1280#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1281extern half2 __attribute__((const, overloadable))
1282 cospi(half2 v);
1283#endif
1284
1285#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1286extern half3 __attribute__((const, overloadable))
1287 cospi(half3 v);
1288#endif
1289
1290#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1291extern half4 __attribute__((const, overloadable))
1292 cospi(half4 v);
1293#endif
1294
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001295/*
1296 * degrees: Converts radians into degrees
1297 *
1298 * Converts from radians to degrees.
1299 */
1300extern float __attribute__((const, overloadable))
1301 degrees(float v);
1302
1303extern float2 __attribute__((const, overloadable))
1304 degrees(float2 v);
1305
1306extern float3 __attribute__((const, overloadable))
1307 degrees(float3 v);
1308
1309extern float4 __attribute__((const, overloadable))
1310 degrees(float4 v);
1311
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001312#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1313extern half __attribute__((const, overloadable))
1314 degrees(half v);
1315#endif
1316
1317#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1318extern half2 __attribute__((const, overloadable))
1319 degrees(half2 v);
1320#endif
1321
1322#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1323extern half3 __attribute__((const, overloadable))
1324 degrees(half3 v);
1325#endif
1326
1327#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1328extern half4 __attribute__((const, overloadable))
1329 degrees(half4 v);
1330#endif
1331
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001332/*
1333 * erf: Mathematical error function
1334 *
1335 * Returns the error function.
1336 */
1337extern float __attribute__((const, overloadable))
1338 erf(float v);
1339
1340extern float2 __attribute__((const, overloadable))
1341 erf(float2 v);
1342
1343extern float3 __attribute__((const, overloadable))
1344 erf(float3 v);
1345
1346extern float4 __attribute__((const, overloadable))
1347 erf(float4 v);
1348
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001349#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1350extern half __attribute__((const, overloadable))
1351 erf(half v);
1352#endif
1353
1354#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1355extern half2 __attribute__((const, overloadable))
1356 erf(half2 v);
1357#endif
1358
1359#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1360extern half3 __attribute__((const, overloadable))
1361 erf(half3 v);
1362#endif
1363
1364#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1365extern half4 __attribute__((const, overloadable))
1366 erf(half4 v);
1367#endif
1368
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001369/*
1370 * erfc: Mathematical complementary error function
1371 *
1372 * Returns the complementary error function.
1373 */
1374extern float __attribute__((const, overloadable))
1375 erfc(float v);
1376
1377extern float2 __attribute__((const, overloadable))
1378 erfc(float2 v);
1379
1380extern float3 __attribute__((const, overloadable))
1381 erfc(float3 v);
1382
1383extern float4 __attribute__((const, overloadable))
1384 erfc(float4 v);
1385
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001386#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1387extern half __attribute__((const, overloadable))
1388 erfc(half v);
1389#endif
1390
1391#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1392extern half2 __attribute__((const, overloadable))
1393 erfc(half2 v);
1394#endif
1395
1396#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1397extern half3 __attribute__((const, overloadable))
1398 erfc(half3 v);
1399#endif
1400
1401#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1402extern half4 __attribute__((const, overloadable))
1403 erfc(half4 v);
1404#endif
1405
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001406/*
1407 * exp: e raised to a number
1408 *
1409 * Returns e raised to v, i.e. e ^ v.
1410 *
1411 * See also native_exp().
1412 */
1413extern float __attribute__((const, overloadable))
1414 exp(float v);
1415
1416extern float2 __attribute__((const, overloadable))
1417 exp(float2 v);
1418
1419extern float3 __attribute__((const, overloadable))
1420 exp(float3 v);
1421
1422extern float4 __attribute__((const, overloadable))
1423 exp(float4 v);
1424
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001425#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1426extern half __attribute__((const, overloadable))
1427 exp(half v);
1428#endif
1429
1430#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1431extern half2 __attribute__((const, overloadable))
1432 exp(half2 v);
1433#endif
1434
1435#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1436extern half3 __attribute__((const, overloadable))
1437 exp(half3 v);
1438#endif
1439
1440#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1441extern half4 __attribute__((const, overloadable))
1442 exp(half4 v);
1443#endif
1444
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001445/*
1446 * exp10: 10 raised to a number
1447 *
1448 * Returns 10 raised to v, i.e. 10.f ^ v.
1449 *
1450 * See also native_exp10().
1451 */
1452extern float __attribute__((const, overloadable))
1453 exp10(float v);
1454
1455extern float2 __attribute__((const, overloadable))
1456 exp10(float2 v);
1457
1458extern float3 __attribute__((const, overloadable))
1459 exp10(float3 v);
1460
1461extern float4 __attribute__((const, overloadable))
1462 exp10(float4 v);
1463
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001464#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1465extern half __attribute__((const, overloadable))
1466 exp10(half v);
1467#endif
1468
1469#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1470extern half2 __attribute__((const, overloadable))
1471 exp10(half2 v);
1472#endif
1473
1474#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1475extern half3 __attribute__((const, overloadable))
1476 exp10(half3 v);
1477#endif
1478
1479#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1480extern half4 __attribute__((const, overloadable))
1481 exp10(half4 v);
1482#endif
1483
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001484/*
1485 * exp2: 2 raised to a number
1486 *
1487 * Returns 2 raised to v, i.e. 2.f ^ v.
1488 *
1489 * See also native_exp2().
1490 */
1491extern float __attribute__((const, overloadable))
1492 exp2(float v);
1493
1494extern float2 __attribute__((const, overloadable))
1495 exp2(float2 v);
1496
1497extern float3 __attribute__((const, overloadable))
1498 exp2(float3 v);
1499
1500extern float4 __attribute__((const, overloadable))
1501 exp2(float4 v);
1502
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001503#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1504extern half __attribute__((const, overloadable))
1505 exp2(half v);
1506#endif
1507
1508#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1509extern half2 __attribute__((const, overloadable))
1510 exp2(half2 v);
1511#endif
1512
1513#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1514extern half3 __attribute__((const, overloadable))
1515 exp2(half3 v);
1516#endif
1517
1518#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1519extern half4 __attribute__((const, overloadable))
1520 exp2(half4 v);
1521#endif
1522
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001523/*
1524 * expm1: e raised to a number minus one
1525 *
1526 * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
1527 *
1528 * See also native_expm1().
1529 */
1530extern float __attribute__((const, overloadable))
1531 expm1(float v);
1532
1533extern float2 __attribute__((const, overloadable))
1534 expm1(float2 v);
1535
1536extern float3 __attribute__((const, overloadable))
1537 expm1(float3 v);
1538
1539extern float4 __attribute__((const, overloadable))
1540 expm1(float4 v);
1541
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001542#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1543extern half __attribute__((const, overloadable))
1544 expm1(half v);
1545#endif
1546
1547#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1548extern half2 __attribute__((const, overloadable))
1549 expm1(half2 v);
1550#endif
1551
1552#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1553extern half3 __attribute__((const, overloadable))
1554 expm1(half3 v);
1555#endif
1556
1557#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1558extern half4 __attribute__((const, overloadable))
1559 expm1(half4 v);
1560#endif
1561
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001562/*
1563 * fabs: Absolute value of a float
1564 *
1565 * Returns the absolute value of the float v.
1566 *
1567 * For integers, use abs().
1568 */
1569extern float __attribute__((const, overloadable))
1570 fabs(float v);
1571
1572extern float2 __attribute__((const, overloadable))
1573 fabs(float2 v);
1574
1575extern float3 __attribute__((const, overloadable))
1576 fabs(float3 v);
1577
1578extern float4 __attribute__((const, overloadable))
1579 fabs(float4 v);
1580
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001581#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1582extern half __attribute__((const, overloadable))
1583 fabs(half v);
1584#endif
1585
1586#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1587extern half2 __attribute__((const, overloadable))
1588 fabs(half2 v);
1589#endif
1590
1591#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1592extern half3 __attribute__((const, overloadable))
1593 fabs(half3 v);
1594#endif
1595
1596#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1597extern half4 __attribute__((const, overloadable))
1598 fabs(half4 v);
1599#endif
1600
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001601/*
1602 * fdim: Positive difference between two values
1603 *
1604 * Returns the positive difference between two values.
1605 *
1606 * If a > b, returns (a - b) otherwise returns 0f.
1607 */
1608extern float __attribute__((const, overloadable))
1609 fdim(float a, float b);
1610
1611extern float2 __attribute__((const, overloadable))
1612 fdim(float2 a, float2 b);
1613
1614extern float3 __attribute__((const, overloadable))
1615 fdim(float3 a, float3 b);
1616
1617extern float4 __attribute__((const, overloadable))
1618 fdim(float4 a, float4 b);
1619
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001620#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1621extern half __attribute__((const, overloadable))
1622 fdim(half a, half b);
1623#endif
1624
1625#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1626extern half2 __attribute__((const, overloadable))
1627 fdim(half2 a, half2 b);
1628#endif
1629
1630#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1631extern half3 __attribute__((const, overloadable))
1632 fdim(half3 a, half3 b);
1633#endif
1634
1635#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1636extern half4 __attribute__((const, overloadable))
1637 fdim(half4 a, half4 b);
1638#endif
1639
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001640/*
1641 * floor: Smallest integer not greater than a value
1642 *
1643 * Returns the smallest integer not greater than a value.
1644 *
1645 * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f.
1646 *
1647 * See also ceil().
1648 */
1649extern float __attribute__((const, overloadable))
1650 floor(float v);
1651
1652extern float2 __attribute__((const, overloadable))
1653 floor(float2 v);
1654
1655extern float3 __attribute__((const, overloadable))
1656 floor(float3 v);
1657
1658extern float4 __attribute__((const, overloadable))
1659 floor(float4 v);
1660
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001661#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1662extern half __attribute__((const, overloadable))
1663 floor(half v);
1664#endif
1665
1666#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1667extern half2 __attribute__((const, overloadable))
1668 floor(half2 v);
1669#endif
1670
1671#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1672extern half3 __attribute__((const, overloadable))
1673 floor(half3 v);
1674#endif
1675
1676#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1677extern half4 __attribute__((const, overloadable))
1678 floor(half4 v);
1679#endif
1680
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001681/*
1682 * fma: Multiply and add
1683 *
1684 * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
1685 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001686 * This function is similar to mad(). fma() retains full precision of the multiplied result
1687 * and rounds only after the addition. mad() rounds after the multiplication and the addition.
1688 * This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001689 */
1690extern float __attribute__((const, overloadable))
1691 fma(float multiplicand1, float multiplicand2, float offset);
1692
1693extern float2 __attribute__((const, overloadable))
1694 fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
1695
1696extern float3 __attribute__((const, overloadable))
1697 fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
1698
1699extern float4 __attribute__((const, overloadable))
1700 fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
1701
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001702#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1703extern half __attribute__((const, overloadable))
1704 fma(half multiplicand1, half multiplicand2, half offset);
1705#endif
1706
1707#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1708extern half2 __attribute__((const, overloadable))
1709 fma(half2 multiplicand1, half2 multiplicand2, half2 offset);
1710#endif
1711
1712#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1713extern half3 __attribute__((const, overloadable))
1714 fma(half3 multiplicand1, half3 multiplicand2, half3 offset);
1715#endif
1716
1717#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1718extern half4 __attribute__((const, overloadable))
1719 fma(half4 multiplicand1, half4 multiplicand2, half4 offset);
1720#endif
1721
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001722/*
1723 * fmax: Maximum of two floats
1724 *
1725 * Returns the maximum of a and b, i.e. (a < b ? b : a).
1726 *
1727 * The max() function returns identical results but can be applied to more data types.
1728 */
1729extern float __attribute__((const, overloadable))
1730 fmax(float a, float b);
1731
1732extern float2 __attribute__((const, overloadable))
1733 fmax(float2 a, float2 b);
1734
1735extern float3 __attribute__((const, overloadable))
1736 fmax(float3 a, float3 b);
1737
1738extern float4 __attribute__((const, overloadable))
1739 fmax(float4 a, float4 b);
1740
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001741#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1742extern half __attribute__((const, overloadable))
1743 fmax(half a, half b);
1744#endif
1745
1746#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1747extern half2 __attribute__((const, overloadable))
1748 fmax(half2 a, half2 b);
1749#endif
1750
1751#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1752extern half3 __attribute__((const, overloadable))
1753 fmax(half3 a, half3 b);
1754#endif
1755
1756#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1757extern half4 __attribute__((const, overloadable))
1758 fmax(half4 a, half4 b);
1759#endif
1760
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001761extern float2 __attribute__((const, overloadable))
1762 fmax(float2 a, float b);
1763
1764extern float3 __attribute__((const, overloadable))
1765 fmax(float3 a, float b);
1766
1767extern float4 __attribute__((const, overloadable))
1768 fmax(float4 a, float b);
1769
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001770#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1771extern half2 __attribute__((const, overloadable))
1772 fmax(half2 a, half b);
1773#endif
1774
1775#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1776extern half3 __attribute__((const, overloadable))
1777 fmax(half3 a, half b);
1778#endif
1779
1780#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1781extern half4 __attribute__((const, overloadable))
1782 fmax(half4 a, half b);
1783#endif
1784
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001785/*
1786 * fmin: Minimum of two floats
1787 *
1788 * Returns the minimum of a and b, i.e. (a > b ? b : a).
1789 *
1790 * The min() function returns identical results but can be applied to more data types.
1791 */
1792extern float __attribute__((const, overloadable))
1793 fmin(float a, float b);
1794
1795extern float2 __attribute__((const, overloadable))
1796 fmin(float2 a, float2 b);
1797
1798extern float3 __attribute__((const, overloadable))
1799 fmin(float3 a, float3 b);
1800
1801extern float4 __attribute__((const, overloadable))
1802 fmin(float4 a, float4 b);
1803
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001804#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1805extern half __attribute__((const, overloadable))
1806 fmin(half a, half b);
1807#endif
1808
1809#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1810extern half2 __attribute__((const, overloadable))
1811 fmin(half2 a, half2 b);
1812#endif
1813
1814#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1815extern half3 __attribute__((const, overloadable))
1816 fmin(half3 a, half3 b);
1817#endif
1818
1819#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1820extern half4 __attribute__((const, overloadable))
1821 fmin(half4 a, half4 b);
1822#endif
1823
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001824extern float2 __attribute__((const, overloadable))
1825 fmin(float2 a, float b);
1826
1827extern float3 __attribute__((const, overloadable))
1828 fmin(float3 a, float b);
1829
1830extern float4 __attribute__((const, overloadable))
1831 fmin(float4 a, float b);
1832
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001833#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1834extern half2 __attribute__((const, overloadable))
1835 fmin(half2 a, half b);
1836#endif
1837
1838#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1839extern half3 __attribute__((const, overloadable))
1840 fmin(half3 a, half b);
1841#endif
1842
1843#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1844extern half4 __attribute__((const, overloadable))
1845 fmin(half4 a, half b);
1846#endif
1847
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001848/*
1849 * fmod: Modulo
1850 *
1851 * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1852 *
1853 * The function remainder() is similar but rounds toward the closest interger.
1854 * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
1855 * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
1856 */
1857extern float __attribute__((const, overloadable))
1858 fmod(float numerator, float denominator);
1859
1860extern float2 __attribute__((const, overloadable))
1861 fmod(float2 numerator, float2 denominator);
1862
1863extern float3 __attribute__((const, overloadable))
1864 fmod(float3 numerator, float3 denominator);
1865
1866extern float4 __attribute__((const, overloadable))
1867 fmod(float4 numerator, float4 denominator);
1868
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08001869#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1870extern half __attribute__((const, overloadable))
1871 fmod(half numerator, half denominator);
1872#endif
1873
1874#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1875extern half2 __attribute__((const, overloadable))
1876 fmod(half2 numerator, half2 denominator);
1877#endif
1878
1879#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1880extern half3 __attribute__((const, overloadable))
1881 fmod(half3 numerator, half3 denominator);
1882#endif
1883
1884#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
1885extern half4 __attribute__((const, overloadable))
1886 fmod(half4 numerator, half4 denominator);
1887#endif
1888
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001889/*
1890 * fract: Positive fractional part
1891 *
1892 * Returns the positive fractional part of v, i.e. v - floor(v).
1893 *
1894 * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
1895 * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
1896 *
1897 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07001898 * v: Input value.
1899 * floor: If floor is not null, *floor will be set to the floor of v.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001900 */
1901extern float __attribute__((overloadable))
1902 fract(float v, float* floor);
1903
1904extern float2 __attribute__((overloadable))
1905 fract(float2 v, float2* floor);
1906
1907extern float3 __attribute__((overloadable))
1908 fract(float3 v, float3* floor);
1909
1910extern float4 __attribute__((overloadable))
1911 fract(float4 v, float4* floor);
1912
1913static inline float __attribute__((const, overloadable))
1914 fract(float v) {
1915 float unused;
1916 return fract(v, &unused);
1917}
1918
1919static inline float2 __attribute__((const, overloadable))
1920 fract(float2 v) {
1921 float2 unused;
1922 return fract(v, &unused);
1923}
1924
1925static inline float3 __attribute__((const, overloadable))
1926 fract(float3 v) {
1927 float3 unused;
1928 return fract(v, &unused);
1929}
1930
1931static inline float4 __attribute__((const, overloadable))
1932 fract(float4 v) {
1933 float4 unused;
1934 return fract(v, &unused);
1935}
1936
1937/*
1938 * frexp: Binary mantissa and exponent
1939 *
1940 * Returns the binary mantissa and exponent of v, i.e. v == mantissa * 2 ^ exponent.
1941 *
1942 * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1943 *
1944 * See ldexp() for the reverse operation. See also logb() and ilogb().
1945 *
1946 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07001947 * v: Input value.
1948 * exponent: If exponent is not null, *exponent will be set to the exponent of v.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001949 */
1950extern float __attribute__((overloadable))
1951 frexp(float v, int* exponent);
1952
1953extern float2 __attribute__((overloadable))
1954 frexp(float2 v, int2* exponent);
1955
1956extern float3 __attribute__((overloadable))
1957 frexp(float3 v, int3* exponent);
1958
1959extern float4 __attribute__((overloadable))
1960 frexp(float4 v, int4* exponent);
1961
1962/*
1963 * half_recip: Reciprocal computed to 16 bit precision
1964 *
1965 * Returns the approximate reciprocal of a value.
1966 *
1967 * The precision is that of a 16 bit floating point value.
1968 *
1969 * See also native_recip().
1970 */
1971#if (defined(RS_VERSION) && (RS_VERSION >= 17))
1972extern float __attribute__((const, overloadable))
1973 half_recip(float v);
1974#endif
1975
1976#if (defined(RS_VERSION) && (RS_VERSION >= 17))
1977extern float2 __attribute__((const, overloadable))
1978 half_recip(float2 v);
1979#endif
1980
1981#if (defined(RS_VERSION) && (RS_VERSION >= 17))
1982extern float3 __attribute__((const, overloadable))
1983 half_recip(float3 v);
1984#endif
1985
1986#if (defined(RS_VERSION) && (RS_VERSION >= 17))
1987extern float4 __attribute__((const, overloadable))
1988 half_recip(float4 v);
1989#endif
1990
1991/*
1992 * half_rsqrt: Reciprocal of a square root computed to 16 bit precision
1993 *
1994 * Returns the approximate value of (1.f / sqrt(value)).
1995 *
1996 * The precision is that of a 16 bit floating point value.
1997 *
1998 * See also rsqrt(), native_rsqrt().
1999 */
2000#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2001extern float __attribute__((const, overloadable))
2002 half_rsqrt(float v);
2003#endif
2004
2005#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2006extern float2 __attribute__((const, overloadable))
2007 half_rsqrt(float2 v);
2008#endif
2009
2010#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2011extern float3 __attribute__((const, overloadable))
2012 half_rsqrt(float3 v);
2013#endif
2014
2015#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2016extern float4 __attribute__((const, overloadable))
2017 half_rsqrt(float4 v);
2018#endif
2019
2020/*
2021 * half_sqrt: Square root computed to 16 bit precision
2022 *
2023 * Returns the approximate square root of a value.
2024 *
2025 * The precision is that of a 16 bit floating point value.
2026 *
2027 * See also sqrt(), native_sqrt().
2028 */
2029#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2030extern float __attribute__((const, overloadable))
2031 half_sqrt(float v);
2032#endif
2033
2034#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2035extern float2 __attribute__((const, overloadable))
2036 half_sqrt(float2 v);
2037#endif
2038
2039#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2040extern float3 __attribute__((const, overloadable))
2041 half_sqrt(float3 v);
2042#endif
2043
2044#if (defined(RS_VERSION) && (RS_VERSION >= 17))
2045extern float4 __attribute__((const, overloadable))
2046 half_sqrt(float4 v);
2047#endif
2048
2049/*
2050 * hypot: Hypotenuse
2051 *
2052 * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
2053 *
2054 * See also native_hypot().
2055 */
2056extern float __attribute__((const, overloadable))
2057 hypot(float a, float b);
2058
2059extern float2 __attribute__((const, overloadable))
2060 hypot(float2 a, float2 b);
2061
2062extern float3 __attribute__((const, overloadable))
2063 hypot(float3 a, float3 b);
2064
2065extern float4 __attribute__((const, overloadable))
2066 hypot(float4 a, float4 b);
2067
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002068#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2069extern half __attribute__((const, overloadable))
2070 hypot(half a, half b);
2071#endif
2072
2073#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2074extern half2 __attribute__((const, overloadable))
2075 hypot(half2 a, half2 b);
2076#endif
2077
2078#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2079extern half3 __attribute__((const, overloadable))
2080 hypot(half3 a, half3 b);
2081#endif
2082
2083#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2084extern half4 __attribute__((const, overloadable))
2085 hypot(half4 a, half4 b);
2086#endif
2087
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002088/*
2089 * ilogb: Base two exponent
2090 *
2091 * Returns the base two exponent of a value, where the mantissa is between
2092 * 1.f (inclusive) and 2.f (exclusive).
2093 *
2094 * For example, ilogb(8.5f) returns 3.
2095 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002096 * Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002097 *
2098 * logb() is similar but returns a float.
2099 */
2100extern int __attribute__((const, overloadable))
2101 ilogb(float v);
2102
2103extern int2 __attribute__((const, overloadable))
2104 ilogb(float2 v);
2105
2106extern int3 __attribute__((const, overloadable))
2107 ilogb(float3 v);
2108
2109extern int4 __attribute__((const, overloadable))
2110 ilogb(float4 v);
2111
2112/*
2113 * ldexp: Creates a floating point from mantissa and exponent
2114 *
2115 * Returns the floating point created from the mantissa and exponent,
2116 * i.e. (mantissa * 2 ^ exponent).
2117 *
2118 * See frexp() for the reverse operation.
2119 *
2120 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002121 * mantissa: Mantissa.
2122 * exponent: Exponent, a single component or matching vector.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002123 */
2124extern float __attribute__((const, overloadable))
2125 ldexp(float mantissa, int exponent);
2126
2127extern float2 __attribute__((const, overloadable))
2128 ldexp(float2 mantissa, int2 exponent);
2129
2130extern float3 __attribute__((const, overloadable))
2131 ldexp(float3 mantissa, int3 exponent);
2132
2133extern float4 __attribute__((const, overloadable))
2134 ldexp(float4 mantissa, int4 exponent);
2135
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002136#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2137extern half __attribute__((const, overloadable))
2138 ldexp(half mantissa, int exponent);
2139#endif
2140
2141#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2142extern half2 __attribute__((const, overloadable))
2143 ldexp(half2 mantissa, int2 exponent);
2144#endif
2145
2146#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2147extern half3 __attribute__((const, overloadable))
2148 ldexp(half3 mantissa, int3 exponent);
2149#endif
2150
2151#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2152extern half4 __attribute__((const, overloadable))
2153 ldexp(half4 mantissa, int4 exponent);
2154#endif
2155
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002156extern float2 __attribute__((const, overloadable))
2157 ldexp(float2 mantissa, int exponent);
2158
2159extern float3 __attribute__((const, overloadable))
2160 ldexp(float3 mantissa, int exponent);
2161
2162extern float4 __attribute__((const, overloadable))
2163 ldexp(float4 mantissa, int exponent);
2164
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002165#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2166extern half2 __attribute__((const, overloadable))
2167 ldexp(half2 mantissa, int exponent);
2168#endif
2169
2170#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2171extern half3 __attribute__((const, overloadable))
2172 ldexp(half3 mantissa, int exponent);
2173#endif
2174
2175#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2176extern half4 __attribute__((const, overloadable))
2177 ldexp(half4 mantissa, int exponent);
2178#endif
2179
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002180/*
2181 * lgamma: Natural logarithm of the gamma function
2182 *
2183 * Returns the natural logarithm of the absolute value of the gamma function,
2184 * i.e. log(fabs(tgamma(v))).
2185 *
2186 * See also tgamma().
2187 *
2188 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07002189 * 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 -07002190 */
2191extern float __attribute__((const, overloadable))
2192 lgamma(float v);
2193
2194extern float2 __attribute__((const, overloadable))
2195 lgamma(float2 v);
2196
2197extern float3 __attribute__((const, overloadable))
2198 lgamma(float3 v);
2199
2200extern float4 __attribute__((const, overloadable))
2201 lgamma(float4 v);
2202
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002203#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2204extern half __attribute__((const, overloadable))
2205 lgamma(half v);
2206#endif
2207
2208#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2209extern half2 __attribute__((const, overloadable))
2210 lgamma(half2 v);
2211#endif
2212
2213#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2214extern half3 __attribute__((const, overloadable))
2215 lgamma(half3 v);
2216#endif
2217
2218#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2219extern half4 __attribute__((const, overloadable))
2220 lgamma(half4 v);
2221#endif
2222
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002223extern float __attribute__((overloadable))
2224 lgamma(float v, int* sign_of_gamma);
2225
2226extern float2 __attribute__((overloadable))
2227 lgamma(float2 v, int2* sign_of_gamma);
2228
2229extern float3 __attribute__((overloadable))
2230 lgamma(float3 v, int3* sign_of_gamma);
2231
2232extern float4 __attribute__((overloadable))
2233 lgamma(float4 v, int4* sign_of_gamma);
2234
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002235#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2236extern half __attribute__((overloadable))
2237 lgamma(half v, int* sign_of_gamma);
2238#endif
2239
2240#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2241extern half2 __attribute__((overloadable))
2242 lgamma(half2 v, int2* sign_of_gamma);
2243#endif
2244
2245#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2246extern half3 __attribute__((overloadable))
2247 lgamma(half3 v, int3* sign_of_gamma);
2248#endif
2249
2250#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2251extern half4 __attribute__((overloadable))
2252 lgamma(half4 v, int4* sign_of_gamma);
2253#endif
2254
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002255/*
2256 * log: Natural logarithm
2257 *
2258 * Returns the natural logarithm.
2259 *
2260 * See also native_log().
2261 */
2262extern float __attribute__((const, overloadable))
2263 log(float v);
2264
2265extern float2 __attribute__((const, overloadable))
2266 log(float2 v);
2267
2268extern float3 __attribute__((const, overloadable))
2269 log(float3 v);
2270
2271extern float4 __attribute__((const, overloadable))
2272 log(float4 v);
2273
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002274#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2275extern half __attribute__((const, overloadable))
2276 log(half v);
2277#endif
2278
2279#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2280extern half2 __attribute__((const, overloadable))
2281 log(half2 v);
2282#endif
2283
2284#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2285extern half3 __attribute__((const, overloadable))
2286 log(half3 v);
2287#endif
2288
2289#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2290extern half4 __attribute__((const, overloadable))
2291 log(half4 v);
2292#endif
2293
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002294/*
2295 * log10: Base 10 logarithm
2296 *
2297 * Returns the base 10 logarithm.
2298 *
2299 * See also native_log10().
2300 */
2301extern float __attribute__((const, overloadable))
2302 log10(float v);
2303
2304extern float2 __attribute__((const, overloadable))
2305 log10(float2 v);
2306
2307extern float3 __attribute__((const, overloadable))
2308 log10(float3 v);
2309
2310extern float4 __attribute__((const, overloadable))
2311 log10(float4 v);
2312
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002313#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2314extern half __attribute__((const, overloadable))
2315 log10(half v);
2316#endif
2317
2318#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2319extern half2 __attribute__((const, overloadable))
2320 log10(half2 v);
2321#endif
2322
2323#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2324extern half3 __attribute__((const, overloadable))
2325 log10(half3 v);
2326#endif
2327
2328#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2329extern half4 __attribute__((const, overloadable))
2330 log10(half4 v);
2331#endif
2332
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002333/*
2334 * log1p: Natural logarithm of a value plus 1
2335 *
2336 * Returns the natural logarithm of (v + 1.f).
2337 *
2338 * See also native_log1p().
2339 */
2340extern float __attribute__((const, overloadable))
2341 log1p(float v);
2342
2343extern float2 __attribute__((const, overloadable))
2344 log1p(float2 v);
2345
2346extern float3 __attribute__((const, overloadable))
2347 log1p(float3 v);
2348
2349extern float4 __attribute__((const, overloadable))
2350 log1p(float4 v);
2351
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002352#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2353extern half __attribute__((const, overloadable))
2354 log1p(half v);
2355#endif
2356
2357#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2358extern half2 __attribute__((const, overloadable))
2359 log1p(half2 v);
2360#endif
2361
2362#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2363extern half3 __attribute__((const, overloadable))
2364 log1p(half3 v);
2365#endif
2366
2367#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2368extern half4 __attribute__((const, overloadable))
2369 log1p(half4 v);
2370#endif
2371
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002372/*
2373 * log2: Base 2 logarithm
2374 *
2375 * Returns the base 2 logarithm.
2376 *
2377 * See also native_log2().
2378 */
2379extern float __attribute__((const, overloadable))
2380 log2(float v);
2381
2382extern float2 __attribute__((const, overloadable))
2383 log2(float2 v);
2384
2385extern float3 __attribute__((const, overloadable))
2386 log2(float3 v);
2387
2388extern float4 __attribute__((const, overloadable))
2389 log2(float4 v);
2390
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002391#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2392extern half __attribute__((const, overloadable))
2393 log2(half v);
2394#endif
2395
2396#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2397extern half2 __attribute__((const, overloadable))
2398 log2(half2 v);
2399#endif
2400
2401#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2402extern half3 __attribute__((const, overloadable))
2403 log2(half3 v);
2404#endif
2405
2406#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2407extern half4 __attribute__((const, overloadable))
2408 log2(half4 v);
2409#endif
2410
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002411/*
2412 * logb: Base two exponent
2413 *
2414 * Returns the base two exponent of a value, where the mantissa is between
2415 * 1.f (inclusive) and 2.f (exclusive).
2416 *
2417 * For example, logb(8.5f) returns 3.f.
2418 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002419 * Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002420 *
2421 * ilogb() is similar but returns an integer.
2422 */
2423extern float __attribute__((const, overloadable))
2424 logb(float v);
2425
2426extern float2 __attribute__((const, overloadable))
2427 logb(float2 v);
2428
2429extern float3 __attribute__((const, overloadable))
2430 logb(float3 v);
2431
2432extern float4 __attribute__((const, overloadable))
2433 logb(float4 v);
2434
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002435#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2436extern half __attribute__((const, overloadable))
2437 logb(half v);
2438#endif
2439
2440#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2441extern half2 __attribute__((const, overloadable))
2442 logb(half2 v);
2443#endif
2444
2445#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2446extern half3 __attribute__((const, overloadable))
2447 logb(half3 v);
2448#endif
2449
2450#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2451extern half4 __attribute__((const, overloadable))
2452 logb(half4 v);
2453#endif
2454
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002455/*
2456 * mad: Multiply and add
2457 *
2458 * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
2459 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002460 * This function is similar to fma(). fma() retains full precision of the multiplied result
2461 * and rounds only after the addition. mad() rounds after the multiplication and the addition.
2462 * In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002463 */
2464extern float __attribute__((const, overloadable))
2465 mad(float multiplicand1, float multiplicand2, float offset);
2466
2467extern float2 __attribute__((const, overloadable))
2468 mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
2469
2470extern float3 __attribute__((const, overloadable))
2471 mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
2472
2473extern float4 __attribute__((const, overloadable))
2474 mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
2475
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002476#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2477extern half __attribute__((const, overloadable))
2478 mad(half multiplicand1, half multiplicand2, half offset);
2479#endif
2480
2481#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2482extern half2 __attribute__((const, overloadable))
2483 mad(half2 multiplicand1, half2 multiplicand2, half2 offset);
2484#endif
2485
2486#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2487extern half3 __attribute__((const, overloadable))
2488 mad(half3 multiplicand1, half3 multiplicand2, half3 offset);
2489#endif
2490
2491#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2492extern half4 __attribute__((const, overloadable))
2493 mad(half4 multiplicand1, half4 multiplicand2, half4 offset);
2494#endif
2495
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002496/*
2497 * max: Maximum
2498 *
2499 * Returns the maximum value of two arguments.
2500 */
2501extern float __attribute__((const, overloadable))
2502 max(float a, float b);
2503
2504extern float2 __attribute__((const, overloadable))
2505 max(float2 a, float2 b);
2506
2507extern float3 __attribute__((const, overloadable))
2508 max(float3 a, float3 b);
2509
2510extern float4 __attribute__((const, overloadable))
2511 max(float4 a, float4 b);
2512
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002513#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2514extern half __attribute__((const, overloadable))
2515 max(half a, half b);
2516#endif
2517
2518#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2519extern half2 __attribute__((const, overloadable))
2520 max(half2 a, half2 b);
2521#endif
2522
2523#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2524extern half3 __attribute__((const, overloadable))
2525 max(half3 a, half3 b);
2526#endif
2527
2528#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2529extern half4 __attribute__((const, overloadable))
2530 max(half4 a, half4 b);
2531#endif
2532
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07002533extern float2 __attribute__((const, overloadable))
2534 max(float2 a, float b);
2535
2536extern float3 __attribute__((const, overloadable))
2537 max(float3 a, float b);
2538
2539extern float4 __attribute__((const, overloadable))
2540 max(float4 a, float b);
2541
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002542#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2543extern half2 __attribute__((const, overloadable))
2544 max(half2 a, half b);
2545#endif
2546
2547#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2548extern half3 __attribute__((const, overloadable))
2549 max(half3 a, half b);
2550#endif
2551
2552#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2553extern half4 __attribute__((const, overloadable))
2554 max(half4 a, half b);
2555#endif
2556
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002557#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2558static inline char __attribute__((const, overloadable))
2559 max(char a, char b) {
2560 return (a > b ? a : b);
2561}
2562#endif
2563
2564#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2565static inline uchar __attribute__((const, overloadable))
2566 max(uchar a, uchar b) {
2567 return (a > b ? a : b);
2568}
2569#endif
2570
2571#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2572static inline short __attribute__((const, overloadable))
2573 max(short a, short b) {
2574 return (a > b ? a : b);
2575}
2576#endif
2577
2578#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2579static inline ushort __attribute__((const, overloadable))
2580 max(ushort a, ushort b) {
2581 return (a > b ? a : b);
2582}
2583#endif
2584
2585#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2586static inline int __attribute__((const, overloadable))
2587 max(int a, int b) {
2588 return (a > b ? a : b);
2589}
2590#endif
2591
2592#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2593static inline uint __attribute__((const, overloadable))
2594 max(uint a, uint b) {
2595 return (a > b ? a : b);
2596}
2597#endif
2598
2599#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2600static inline char2 __attribute__((const, overloadable))
2601 max(char2 a, char2 b) {
2602 char2 tmp;
2603 tmp.x = (a.x > b.x ? a.x : b.x);
2604 tmp.y = (a.y > b.y ? a.y : b.y);
2605 return tmp;
2606}
2607#endif
2608
2609#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2610static inline uchar2 __attribute__((const, overloadable))
2611 max(uchar2 a, uchar2 b) {
2612 uchar2 tmp;
2613 tmp.x = (a.x > b.x ? a.x : b.x);
2614 tmp.y = (a.y > b.y ? a.y : b.y);
2615 return tmp;
2616}
2617#endif
2618
2619#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2620static inline short2 __attribute__((const, overloadable))
2621 max(short2 a, short2 b) {
2622 short2 tmp;
2623 tmp.x = (a.x > b.x ? a.x : b.x);
2624 tmp.y = (a.y > b.y ? a.y : b.y);
2625 return tmp;
2626}
2627#endif
2628
2629#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2630static inline ushort2 __attribute__((const, overloadable))
2631 max(ushort2 a, ushort2 b) {
2632 ushort2 tmp;
2633 tmp.x = (a.x > b.x ? a.x : b.x);
2634 tmp.y = (a.y > b.y ? a.y : b.y);
2635 return tmp;
2636}
2637#endif
2638
2639#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2640static inline int2 __attribute__((const, overloadable))
2641 max(int2 a, int2 b) {
2642 int2 tmp;
2643 tmp.x = (a.x > b.x ? a.x : b.x);
2644 tmp.y = (a.y > b.y ? a.y : b.y);
2645 return tmp;
2646}
2647#endif
2648
2649#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2650static inline uint2 __attribute__((const, overloadable))
2651 max(uint2 a, uint2 b) {
2652 uint2 tmp;
2653 tmp.x = (a.x > b.x ? a.x : b.x);
2654 tmp.y = (a.y > b.y ? a.y : b.y);
2655 return tmp;
2656}
2657#endif
2658
2659#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2660static inline char3 __attribute__((const, overloadable))
2661 max(char3 a, char3 b) {
2662 char3 tmp;
2663 tmp.x = (a.x > b.x ? a.x : b.x);
2664 tmp.y = (a.y > b.y ? a.y : b.y);
2665 tmp.z = (a.z > b.z ? a.z : b.z);
2666 return tmp;
2667}
2668#endif
2669
2670#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2671static inline uchar3 __attribute__((const, overloadable))
2672 max(uchar3 a, uchar3 b) {
2673 uchar3 tmp;
2674 tmp.x = (a.x > b.x ? a.x : b.x);
2675 tmp.y = (a.y > b.y ? a.y : b.y);
2676 tmp.z = (a.z > b.z ? a.z : b.z);
2677 return tmp;
2678}
2679#endif
2680
2681#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2682static inline short3 __attribute__((const, overloadable))
2683 max(short3 a, short3 b) {
2684 short3 tmp;
2685 tmp.x = (a.x > b.x ? a.x : b.x);
2686 tmp.y = (a.y > b.y ? a.y : b.y);
2687 tmp.z = (a.z > b.z ? a.z : b.z);
2688 return tmp;
2689}
2690#endif
2691
2692#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2693static inline ushort3 __attribute__((const, overloadable))
2694 max(ushort3 a, ushort3 b) {
2695 ushort3 tmp;
2696 tmp.x = (a.x > b.x ? a.x : b.x);
2697 tmp.y = (a.y > b.y ? a.y : b.y);
2698 tmp.z = (a.z > b.z ? a.z : b.z);
2699 return tmp;
2700}
2701#endif
2702
2703#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2704static inline int3 __attribute__((const, overloadable))
2705 max(int3 a, int3 b) {
2706 int3 tmp;
2707 tmp.x = (a.x > b.x ? a.x : b.x);
2708 tmp.y = (a.y > b.y ? a.y : b.y);
2709 tmp.z = (a.z > b.z ? a.z : b.z);
2710 return tmp;
2711}
2712#endif
2713
2714#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2715static inline uint3 __attribute__((const, overloadable))
2716 max(uint3 a, uint3 b) {
2717 uint3 tmp;
2718 tmp.x = (a.x > b.x ? a.x : b.x);
2719 tmp.y = (a.y > b.y ? a.y : b.y);
2720 tmp.z = (a.z > b.z ? a.z : b.z);
2721 return tmp;
2722}
2723#endif
2724
2725#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2726static inline char4 __attribute__((const, overloadable))
2727 max(char4 a, char4 b) {
2728 char4 tmp;
2729 tmp.x = (a.x > b.x ? a.x : b.x);
2730 tmp.y = (a.y > b.y ? a.y : b.y);
2731 tmp.z = (a.z > b.z ? a.z : b.z);
2732 tmp.w = (a.w > b.w ? a.w : b.w);
2733 return tmp;
2734}
2735#endif
2736
2737#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2738static inline uchar4 __attribute__((const, overloadable))
2739 max(uchar4 a, uchar4 b) {
2740 uchar4 tmp;
2741 tmp.x = (a.x > b.x ? a.x : b.x);
2742 tmp.y = (a.y > b.y ? a.y : b.y);
2743 tmp.z = (a.z > b.z ? a.z : b.z);
2744 tmp.w = (a.w > b.w ? a.w : b.w);
2745 return tmp;
2746}
2747#endif
2748
2749#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2750static inline short4 __attribute__((const, overloadable))
2751 max(short4 a, short4 b) {
2752 short4 tmp;
2753 tmp.x = (a.x > b.x ? a.x : b.x);
2754 tmp.y = (a.y > b.y ? a.y : b.y);
2755 tmp.z = (a.z > b.z ? a.z : b.z);
2756 tmp.w = (a.w > b.w ? a.w : b.w);
2757 return tmp;
2758}
2759#endif
2760
2761#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2762static inline ushort4 __attribute__((const, overloadable))
2763 max(ushort4 a, ushort4 b) {
2764 ushort4 tmp;
2765 tmp.x = (a.x > b.x ? a.x : b.x);
2766 tmp.y = (a.y > b.y ? a.y : b.y);
2767 tmp.z = (a.z > b.z ? a.z : b.z);
2768 tmp.w = (a.w > b.w ? a.w : b.w);
2769 return tmp;
2770}
2771#endif
2772
2773#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2774static inline int4 __attribute__((const, overloadable))
2775 max(int4 a, int4 b) {
2776 int4 tmp;
2777 tmp.x = (a.x > b.x ? a.x : b.x);
2778 tmp.y = (a.y > b.y ? a.y : b.y);
2779 tmp.z = (a.z > b.z ? a.z : b.z);
2780 tmp.w = (a.w > b.w ? a.w : b.w);
2781 return tmp;
2782}
2783#endif
2784
2785#if !defined(RS_VERSION) || (RS_VERSION <= 20)
2786static inline uint4 __attribute__((const, overloadable))
2787 max(uint4 a, uint4 b) {
2788 uint4 tmp;
2789 tmp.x = (a.x > b.x ? a.x : b.x);
2790 tmp.y = (a.y > b.y ? a.y : b.y);
2791 tmp.z = (a.z > b.z ? a.z : b.z);
2792 tmp.w = (a.w > b.w ? a.w : b.w);
2793 return tmp;
2794}
2795#endif
2796
2797#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2798extern char __attribute__((const, overloadable))
2799 max(char a, char b);
2800#endif
2801
2802#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2803extern char2 __attribute__((const, overloadable))
2804 max(char2 a, char2 b);
2805#endif
2806
2807#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2808extern char3 __attribute__((const, overloadable))
2809 max(char3 a, char3 b);
2810#endif
2811
2812#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2813extern char4 __attribute__((const, overloadable))
2814 max(char4 a, char4 b);
2815#endif
2816
2817#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2818extern uchar __attribute__((const, overloadable))
2819 max(uchar a, uchar b);
2820#endif
2821
2822#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2823extern uchar2 __attribute__((const, overloadable))
2824 max(uchar2 a, uchar2 b);
2825#endif
2826
2827#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2828extern uchar3 __attribute__((const, overloadable))
2829 max(uchar3 a, uchar3 b);
2830#endif
2831
2832#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2833extern uchar4 __attribute__((const, overloadable))
2834 max(uchar4 a, uchar4 b);
2835#endif
2836
2837#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2838extern short __attribute__((const, overloadable))
2839 max(short a, short b);
2840#endif
2841
2842#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2843extern short2 __attribute__((const, overloadable))
2844 max(short2 a, short2 b);
2845#endif
2846
2847#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2848extern short3 __attribute__((const, overloadable))
2849 max(short3 a, short3 b);
2850#endif
2851
2852#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2853extern short4 __attribute__((const, overloadable))
2854 max(short4 a, short4 b);
2855#endif
2856
2857#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2858extern ushort __attribute__((const, overloadable))
2859 max(ushort a, ushort b);
2860#endif
2861
2862#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2863extern ushort2 __attribute__((const, overloadable))
2864 max(ushort2 a, ushort2 b);
2865#endif
2866
2867#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2868extern ushort3 __attribute__((const, overloadable))
2869 max(ushort3 a, ushort3 b);
2870#endif
2871
2872#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2873extern ushort4 __attribute__((const, overloadable))
2874 max(ushort4 a, ushort4 b);
2875#endif
2876
2877#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2878extern int __attribute__((const, overloadable))
2879 max(int a, int b);
2880#endif
2881
2882#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2883extern int2 __attribute__((const, overloadable))
2884 max(int2 a, int2 b);
2885#endif
2886
2887#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2888extern int3 __attribute__((const, overloadable))
2889 max(int3 a, int3 b);
2890#endif
2891
2892#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2893extern int4 __attribute__((const, overloadable))
2894 max(int4 a, int4 b);
2895#endif
2896
2897#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2898extern uint __attribute__((const, overloadable))
2899 max(uint a, uint b);
2900#endif
2901
2902#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2903extern uint2 __attribute__((const, overloadable))
2904 max(uint2 a, uint2 b);
2905#endif
2906
2907#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2908extern uint3 __attribute__((const, overloadable))
2909 max(uint3 a, uint3 b);
2910#endif
2911
2912#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2913extern uint4 __attribute__((const, overloadable))
2914 max(uint4 a, uint4 b);
2915#endif
2916
2917#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2918extern long __attribute__((const, overloadable))
2919 max(long a, long b);
2920#endif
2921
2922#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2923extern long2 __attribute__((const, overloadable))
2924 max(long2 a, long2 b);
2925#endif
2926
2927#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2928extern long3 __attribute__((const, overloadable))
2929 max(long3 a, long3 b);
2930#endif
2931
2932#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2933extern long4 __attribute__((const, overloadable))
2934 max(long4 a, long4 b);
2935#endif
2936
2937#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2938extern ulong __attribute__((const, overloadable))
2939 max(ulong a, ulong b);
2940#endif
2941
2942#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2943extern ulong2 __attribute__((const, overloadable))
2944 max(ulong2 a, ulong2 b);
2945#endif
2946
2947#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2948extern ulong3 __attribute__((const, overloadable))
2949 max(ulong3 a, ulong3 b);
2950#endif
2951
2952#if (defined(RS_VERSION) && (RS_VERSION >= 21))
2953extern ulong4 __attribute__((const, overloadable))
2954 max(ulong4 a, ulong4 b);
2955#endif
2956
2957/*
2958 * min: Minimum
2959 *
2960 * Returns the minimum value of two arguments.
2961 */
2962extern float __attribute__((const, overloadable))
2963 min(float a, float b);
2964
2965extern float2 __attribute__((const, overloadable))
2966 min(float2 a, float2 b);
2967
2968extern float3 __attribute__((const, overloadable))
2969 min(float3 a, float3 b);
2970
2971extern float4 __attribute__((const, overloadable))
2972 min(float4 a, float4 b);
2973
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08002974#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2975extern half __attribute__((const, overloadable))
2976 min(half a, half b);
2977#endif
2978
2979#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2980extern half2 __attribute__((const, overloadable))
2981 min(half2 a, half2 b);
2982#endif
2983
2984#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2985extern half3 __attribute__((const, overloadable))
2986 min(half3 a, half3 b);
2987#endif
2988
2989#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
2990extern half4 __attribute__((const, overloadable))
2991 min(half4 a, half4 b);
2992#endif
2993
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07002994extern float2 __attribute__((const, overloadable))
2995 min(float2 a, float b);
2996
2997extern float3 __attribute__((const, overloadable))
2998 min(float3 a, float b);
2999
3000extern float4 __attribute__((const, overloadable))
3001 min(float4 a, float b);
3002
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003003#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3004extern half2 __attribute__((const, overloadable))
3005 min(half2 a, half b);
3006#endif
3007
3008#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3009extern half3 __attribute__((const, overloadable))
3010 min(half3 a, half b);
3011#endif
3012
3013#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3014extern half4 __attribute__((const, overloadable))
3015 min(half4 a, half b);
3016#endif
3017
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003018#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3019static inline char __attribute__((const, overloadable))
3020 min(char a, char b) {
3021 return (a < b ? a : b);
3022}
3023#endif
3024
3025#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3026static inline uchar __attribute__((const, overloadable))
3027 min(uchar a, uchar b) {
3028 return (a < b ? a : b);
3029}
3030#endif
3031
3032#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3033static inline short __attribute__((const, overloadable))
3034 min(short a, short b) {
3035 return (a < b ? a : b);
3036}
3037#endif
3038
3039#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3040static inline ushort __attribute__((const, overloadable))
3041 min(ushort a, ushort b) {
3042 return (a < b ? a : b);
3043}
3044#endif
3045
3046#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3047static inline int __attribute__((const, overloadable))
3048 min(int a, int b) {
3049 return (a < b ? a : b);
3050}
3051#endif
3052
3053#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3054static inline uint __attribute__((const, overloadable))
3055 min(uint a, uint b) {
3056 return (a < b ? a : b);
3057}
3058#endif
3059
3060#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3061static inline char2 __attribute__((const, overloadable))
3062 min(char2 a, char2 b) {
3063 char2 tmp;
3064 tmp.x = (a.x < b.x ? a.x : b.x);
3065 tmp.y = (a.y < b.y ? a.y : b.y);
3066 return tmp;
3067}
3068#endif
3069
3070#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3071static inline uchar2 __attribute__((const, overloadable))
3072 min(uchar2 a, uchar2 b) {
3073 uchar2 tmp;
3074 tmp.x = (a.x < b.x ? a.x : b.x);
3075 tmp.y = (a.y < b.y ? a.y : b.y);
3076 return tmp;
3077}
3078#endif
3079
3080#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3081static inline short2 __attribute__((const, overloadable))
3082 min(short2 a, short2 b) {
3083 short2 tmp;
3084 tmp.x = (a.x < b.x ? a.x : b.x);
3085 tmp.y = (a.y < b.y ? a.y : b.y);
3086 return tmp;
3087}
3088#endif
3089
3090#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3091static inline ushort2 __attribute__((const, overloadable))
3092 min(ushort2 a, ushort2 b) {
3093 ushort2 tmp;
3094 tmp.x = (a.x < b.x ? a.x : b.x);
3095 tmp.y = (a.y < b.y ? a.y : b.y);
3096 return tmp;
3097}
3098#endif
3099
3100#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3101static inline int2 __attribute__((const, overloadable))
3102 min(int2 a, int2 b) {
3103 int2 tmp;
3104 tmp.x = (a.x < b.x ? a.x : b.x);
3105 tmp.y = (a.y < b.y ? a.y : b.y);
3106 return tmp;
3107}
3108#endif
3109
3110#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3111static inline uint2 __attribute__((const, overloadable))
3112 min(uint2 a, uint2 b) {
3113 uint2 tmp;
3114 tmp.x = (a.x < b.x ? a.x : b.x);
3115 tmp.y = (a.y < b.y ? a.y : b.y);
3116 return tmp;
3117}
3118#endif
3119
3120#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3121static inline char3 __attribute__((const, overloadable))
3122 min(char3 a, char3 b) {
3123 char3 tmp;
3124 tmp.x = (a.x < b.x ? a.x : b.x);
3125 tmp.y = (a.y < b.y ? a.y : b.y);
3126 tmp.z = (a.z < b.z ? a.z : b.z);
3127 return tmp;
3128}
3129#endif
3130
3131#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3132static inline uchar3 __attribute__((const, overloadable))
3133 min(uchar3 a, uchar3 b) {
3134 uchar3 tmp;
3135 tmp.x = (a.x < b.x ? a.x : b.x);
3136 tmp.y = (a.y < b.y ? a.y : b.y);
3137 tmp.z = (a.z < b.z ? a.z : b.z);
3138 return tmp;
3139}
3140#endif
3141
3142#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3143static inline short3 __attribute__((const, overloadable))
3144 min(short3 a, short3 b) {
3145 short3 tmp;
3146 tmp.x = (a.x < b.x ? a.x : b.x);
3147 tmp.y = (a.y < b.y ? a.y : b.y);
3148 tmp.z = (a.z < b.z ? a.z : b.z);
3149 return tmp;
3150}
3151#endif
3152
3153#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3154static inline ushort3 __attribute__((const, overloadable))
3155 min(ushort3 a, ushort3 b) {
3156 ushort3 tmp;
3157 tmp.x = (a.x < b.x ? a.x : b.x);
3158 tmp.y = (a.y < b.y ? a.y : b.y);
3159 tmp.z = (a.z < b.z ? a.z : b.z);
3160 return tmp;
3161}
3162#endif
3163
3164#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3165static inline int3 __attribute__((const, overloadable))
3166 min(int3 a, int3 b) {
3167 int3 tmp;
3168 tmp.x = (a.x < b.x ? a.x : b.x);
3169 tmp.y = (a.y < b.y ? a.y : b.y);
3170 tmp.z = (a.z < b.z ? a.z : b.z);
3171 return tmp;
3172}
3173#endif
3174
3175#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3176static inline uint3 __attribute__((const, overloadable))
3177 min(uint3 a, uint3 b) {
3178 uint3 tmp;
3179 tmp.x = (a.x < b.x ? a.x : b.x);
3180 tmp.y = (a.y < b.y ? a.y : b.y);
3181 tmp.z = (a.z < b.z ? a.z : b.z);
3182 return tmp;
3183}
3184#endif
3185
3186#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3187static inline char4 __attribute__((const, overloadable))
3188 min(char4 a, char4 b) {
3189 char4 tmp;
3190 tmp.x = (a.x < b.x ? a.x : b.x);
3191 tmp.y = (a.y < b.y ? a.y : b.y);
3192 tmp.z = (a.z < b.z ? a.z : b.z);
3193 tmp.w = (a.w < b.w ? a.w : b.w);
3194 return tmp;
3195}
3196#endif
3197
3198#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3199static inline uchar4 __attribute__((const, overloadable))
3200 min(uchar4 a, uchar4 b) {
3201 uchar4 tmp;
3202 tmp.x = (a.x < b.x ? a.x : b.x);
3203 tmp.y = (a.y < b.y ? a.y : b.y);
3204 tmp.z = (a.z < b.z ? a.z : b.z);
3205 tmp.w = (a.w < b.w ? a.w : b.w);
3206 return tmp;
3207}
3208#endif
3209
3210#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3211static inline short4 __attribute__((const, overloadable))
3212 min(short4 a, short4 b) {
3213 short4 tmp;
3214 tmp.x = (a.x < b.x ? a.x : b.x);
3215 tmp.y = (a.y < b.y ? a.y : b.y);
3216 tmp.z = (a.z < b.z ? a.z : b.z);
3217 tmp.w = (a.w < b.w ? a.w : b.w);
3218 return tmp;
3219}
3220#endif
3221
3222#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3223static inline ushort4 __attribute__((const, overloadable))
3224 min(ushort4 a, ushort4 b) {
3225 ushort4 tmp;
3226 tmp.x = (a.x < b.x ? a.x : b.x);
3227 tmp.y = (a.y < b.y ? a.y : b.y);
3228 tmp.z = (a.z < b.z ? a.z : b.z);
3229 tmp.w = (a.w < b.w ? a.w : b.w);
3230 return tmp;
3231}
3232#endif
3233
3234#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3235static inline int4 __attribute__((const, overloadable))
3236 min(int4 a, int4 b) {
3237 int4 tmp;
3238 tmp.x = (a.x < b.x ? a.x : b.x);
3239 tmp.y = (a.y < b.y ? a.y : b.y);
3240 tmp.z = (a.z < b.z ? a.z : b.z);
3241 tmp.w = (a.w < b.w ? a.w : b.w);
3242 return tmp;
3243}
3244#endif
3245
3246#if !defined(RS_VERSION) || (RS_VERSION <= 20)
3247static inline uint4 __attribute__((const, overloadable))
3248 min(uint4 a, uint4 b) {
3249 uint4 tmp;
3250 tmp.x = (a.x < b.x ? a.x : b.x);
3251 tmp.y = (a.y < b.y ? a.y : b.y);
3252 tmp.z = (a.z < b.z ? a.z : b.z);
3253 tmp.w = (a.w < b.w ? a.w : b.w);
3254 return tmp;
3255}
3256#endif
3257
3258#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3259extern char __attribute__((const, overloadable))
3260 min(char a, char b);
3261#endif
3262
3263#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3264extern char2 __attribute__((const, overloadable))
3265 min(char2 a, char2 b);
3266#endif
3267
3268#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3269extern char3 __attribute__((const, overloadable))
3270 min(char3 a, char3 b);
3271#endif
3272
3273#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3274extern char4 __attribute__((const, overloadable))
3275 min(char4 a, char4 b);
3276#endif
3277
3278#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3279extern uchar __attribute__((const, overloadable))
3280 min(uchar a, uchar b);
3281#endif
3282
3283#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3284extern uchar2 __attribute__((const, overloadable))
3285 min(uchar2 a, uchar2 b);
3286#endif
3287
3288#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3289extern uchar3 __attribute__((const, overloadable))
3290 min(uchar3 a, uchar3 b);
3291#endif
3292
3293#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3294extern uchar4 __attribute__((const, overloadable))
3295 min(uchar4 a, uchar4 b);
3296#endif
3297
3298#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3299extern short __attribute__((const, overloadable))
3300 min(short a, short b);
3301#endif
3302
3303#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3304extern short2 __attribute__((const, overloadable))
3305 min(short2 a, short2 b);
3306#endif
3307
3308#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3309extern short3 __attribute__((const, overloadable))
3310 min(short3 a, short3 b);
3311#endif
3312
3313#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3314extern short4 __attribute__((const, overloadable))
3315 min(short4 a, short4 b);
3316#endif
3317
3318#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3319extern ushort __attribute__((const, overloadable))
3320 min(ushort a, ushort b);
3321#endif
3322
3323#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3324extern ushort2 __attribute__((const, overloadable))
3325 min(ushort2 a, ushort2 b);
3326#endif
3327
3328#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3329extern ushort3 __attribute__((const, overloadable))
3330 min(ushort3 a, ushort3 b);
3331#endif
3332
3333#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3334extern ushort4 __attribute__((const, overloadable))
3335 min(ushort4 a, ushort4 b);
3336#endif
3337
3338#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3339extern int __attribute__((const, overloadable))
3340 min(int a, int b);
3341#endif
3342
3343#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3344extern int2 __attribute__((const, overloadable))
3345 min(int2 a, int2 b);
3346#endif
3347
3348#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3349extern int3 __attribute__((const, overloadable))
3350 min(int3 a, int3 b);
3351#endif
3352
3353#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3354extern int4 __attribute__((const, overloadable))
3355 min(int4 a, int4 b);
3356#endif
3357
3358#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3359extern uint __attribute__((const, overloadable))
3360 min(uint a, uint b);
3361#endif
3362
3363#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3364extern uint2 __attribute__((const, overloadable))
3365 min(uint2 a, uint2 b);
3366#endif
3367
3368#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3369extern uint3 __attribute__((const, overloadable))
3370 min(uint3 a, uint3 b);
3371#endif
3372
3373#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3374extern uint4 __attribute__((const, overloadable))
3375 min(uint4 a, uint4 b);
3376#endif
3377
3378#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3379extern long __attribute__((const, overloadable))
3380 min(long a, long b);
3381#endif
3382
3383#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3384extern long2 __attribute__((const, overloadable))
3385 min(long2 a, long2 b);
3386#endif
3387
3388#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3389extern long3 __attribute__((const, overloadable))
3390 min(long3 a, long3 b);
3391#endif
3392
3393#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3394extern long4 __attribute__((const, overloadable))
3395 min(long4 a, long4 b);
3396#endif
3397
3398#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3399extern ulong __attribute__((const, overloadable))
3400 min(ulong a, ulong b);
3401#endif
3402
3403#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3404extern ulong2 __attribute__((const, overloadable))
3405 min(ulong2 a, ulong2 b);
3406#endif
3407
3408#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3409extern ulong3 __attribute__((const, overloadable))
3410 min(ulong3 a, ulong3 b);
3411#endif
3412
3413#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3414extern ulong4 __attribute__((const, overloadable))
3415 min(ulong4 a, ulong4 b);
3416#endif
3417
3418/*
3419 * mix: Mixes two values
3420 *
3421 * Returns start + ((stop - start) * fraction).
3422 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003423 * This can be useful for mixing two values. For example, to create a new color that is
3424 * 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003425 */
3426extern float __attribute__((const, overloadable))
3427 mix(float start, float stop, float fraction);
3428
3429extern float2 __attribute__((const, overloadable))
3430 mix(float2 start, float2 stop, float2 fraction);
3431
3432extern float3 __attribute__((const, overloadable))
3433 mix(float3 start, float3 stop, float3 fraction);
3434
3435extern float4 __attribute__((const, overloadable))
3436 mix(float4 start, float4 stop, float4 fraction);
3437
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003438#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3439extern half __attribute__((const, overloadable))
3440 mix(half start, half stop, half fraction);
3441#endif
3442
3443#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3444extern half2 __attribute__((const, overloadable))
3445 mix(half2 start, half2 stop, half2 fraction);
3446#endif
3447
3448#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3449extern half3 __attribute__((const, overloadable))
3450 mix(half3 start, half3 stop, half3 fraction);
3451#endif
3452
3453#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3454extern half4 __attribute__((const, overloadable))
3455 mix(half4 start, half4 stop, half4 fraction);
3456#endif
3457
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003458extern float2 __attribute__((const, overloadable))
3459 mix(float2 start, float2 stop, float fraction);
3460
3461extern float3 __attribute__((const, overloadable))
3462 mix(float3 start, float3 stop, float fraction);
3463
3464extern float4 __attribute__((const, overloadable))
3465 mix(float4 start, float4 stop, float fraction);
3466
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003467#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3468extern half2 __attribute__((const, overloadable))
3469 mix(half2 start, half2 stop, half fraction);
3470#endif
3471
3472#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3473extern half3 __attribute__((const, overloadable))
3474 mix(half3 start, half3 stop, half fraction);
3475#endif
3476
3477#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3478extern half4 __attribute__((const, overloadable))
3479 mix(half4 start, half4 stop, half fraction);
3480#endif
3481
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003482/*
3483 * modf: Integral and fractional components
3484 *
3485 * Returns the integral and fractional components of a number.
3486 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003487 * 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 -08003488 * *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003489 *
3490 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003491 * v: Source value.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07003492 * integral_part: *integral_part will be set to the integral portion of the number.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003493 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003494 * Returns: Floating point portion of the value.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003495 */
3496extern float __attribute__((overloadable))
3497 modf(float v, float* integral_part);
3498
3499extern float2 __attribute__((overloadable))
3500 modf(float2 v, float2* integral_part);
3501
3502extern float3 __attribute__((overloadable))
3503 modf(float3 v, float3* integral_part);
3504
3505extern float4 __attribute__((overloadable))
3506 modf(float4 v, float4* integral_part);
3507
3508/*
3509 * nan: Not a Number
3510 *
3511 * Returns a NaN value (Not a Number).
3512 *
3513 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07003514 * v: Not used.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003515 */
3516extern float __attribute__((const, overloadable))
3517 nan(uint v);
3518
3519/*
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003520 * nan_half: Not a Number
3521 *
3522 * Returns a half-precision floating point NaN value (Not a Number).
3523 */
3524#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 4294967295))
3525extern half __attribute__((const, overloadable))
3526 nan_half(void);
3527#endif
3528
3529/*
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003530 * native_acos: Approximate inverse cosine
3531 *
3532 * Returns the approximate inverse cosine, in radians.
3533 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003534 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003535 *
3536 * See also acos().
3537 */
3538#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3539extern float __attribute__((const, overloadable))
3540 native_acos(float v);
3541#endif
3542
3543#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3544extern float2 __attribute__((const, overloadable))
3545 native_acos(float2 v);
3546#endif
3547
3548#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3549extern float3 __attribute__((const, overloadable))
3550 native_acos(float3 v);
3551#endif
3552
3553#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3554extern float4 __attribute__((const, overloadable))
3555 native_acos(float4 v);
3556#endif
3557
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003558#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3559extern half __attribute__((const, overloadable))
3560 native_acos(half v);
3561#endif
3562
3563#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3564extern half2 __attribute__((const, overloadable))
3565 native_acos(half2 v);
3566#endif
3567
3568#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3569extern half3 __attribute__((const, overloadable))
3570 native_acos(half3 v);
3571#endif
3572
3573#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3574extern half4 __attribute__((const, overloadable))
3575 native_acos(half4 v);
3576#endif
3577
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003578/*
3579 * native_acosh: Approximate inverse hyperbolic cosine
3580 *
3581 * Returns the approximate inverse hyperbolic cosine, in radians.
3582 *
3583 * See also acosh().
3584 */
3585#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3586extern float __attribute__((const, overloadable))
3587 native_acosh(float v);
3588#endif
3589
3590#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3591extern float2 __attribute__((const, overloadable))
3592 native_acosh(float2 v);
3593#endif
3594
3595#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3596extern float3 __attribute__((const, overloadable))
3597 native_acosh(float3 v);
3598#endif
3599
3600#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3601extern float4 __attribute__((const, overloadable))
3602 native_acosh(float4 v);
3603#endif
3604
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003605#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3606extern half __attribute__((const, overloadable))
3607 native_acosh(half v);
3608#endif
3609
3610#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3611extern half2 __attribute__((const, overloadable))
3612 native_acosh(half2 v);
3613#endif
3614
3615#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3616extern half3 __attribute__((const, overloadable))
3617 native_acosh(half3 v);
3618#endif
3619
3620#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3621extern half4 __attribute__((const, overloadable))
3622 native_acosh(half4 v);
3623#endif
3624
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003625/*
3626 * native_acospi: Approximate inverse cosine divided by pi
3627 *
3628 * Returns the approximate inverse cosine in radians, divided by pi.
3629 *
3630 * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
3631 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003632 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003633 *
3634 * See also acospi().
3635 */
3636#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3637extern float __attribute__((const, overloadable))
3638 native_acospi(float v);
3639#endif
3640
3641#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3642extern float2 __attribute__((const, overloadable))
3643 native_acospi(float2 v);
3644#endif
3645
3646#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3647extern float3 __attribute__((const, overloadable))
3648 native_acospi(float3 v);
3649#endif
3650
3651#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3652extern float4 __attribute__((const, overloadable))
3653 native_acospi(float4 v);
3654#endif
3655
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003656#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3657extern half __attribute__((const, overloadable))
3658 native_acospi(half v);
3659#endif
3660
3661#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3662extern half2 __attribute__((const, overloadable))
3663 native_acospi(half2 v);
3664#endif
3665
3666#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3667extern half3 __attribute__((const, overloadable))
3668 native_acospi(half3 v);
3669#endif
3670
3671#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3672extern half4 __attribute__((const, overloadable))
3673 native_acospi(half4 v);
3674#endif
3675
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003676/*
3677 * native_asin: Approximate inverse sine
3678 *
3679 * Returns the approximate inverse sine, in radians.
3680 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003681 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003682 *
3683 * See also asin().
3684 */
3685#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3686extern float __attribute__((const, overloadable))
3687 native_asin(float v);
3688#endif
3689
3690#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3691extern float2 __attribute__((const, overloadable))
3692 native_asin(float2 v);
3693#endif
3694
3695#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3696extern float3 __attribute__((const, overloadable))
3697 native_asin(float3 v);
3698#endif
3699
3700#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3701extern float4 __attribute__((const, overloadable))
3702 native_asin(float4 v);
3703#endif
3704
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003705#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3706extern half __attribute__((const, overloadable))
3707 native_asin(half v);
3708#endif
3709
3710#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3711extern half2 __attribute__((const, overloadable))
3712 native_asin(half2 v);
3713#endif
3714
3715#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3716extern half3 __attribute__((const, overloadable))
3717 native_asin(half3 v);
3718#endif
3719
3720#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3721extern half4 __attribute__((const, overloadable))
3722 native_asin(half4 v);
3723#endif
3724
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003725/*
3726 * native_asinh: Approximate inverse hyperbolic sine
3727 *
3728 * Returns the approximate inverse hyperbolic sine, in radians.
3729 *
3730 * See also asinh().
3731 */
3732#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3733extern float __attribute__((const, overloadable))
3734 native_asinh(float v);
3735#endif
3736
3737#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3738extern float2 __attribute__((const, overloadable))
3739 native_asinh(float2 v);
3740#endif
3741
3742#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3743extern float3 __attribute__((const, overloadable))
3744 native_asinh(float3 v);
3745#endif
3746
3747#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3748extern float4 __attribute__((const, overloadable))
3749 native_asinh(float4 v);
3750#endif
3751
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003752#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3753extern half __attribute__((const, overloadable))
3754 native_asinh(half v);
3755#endif
3756
3757#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3758extern half2 __attribute__((const, overloadable))
3759 native_asinh(half2 v);
3760#endif
3761
3762#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3763extern half3 __attribute__((const, overloadable))
3764 native_asinh(half3 v);
3765#endif
3766
3767#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3768extern half4 __attribute__((const, overloadable))
3769 native_asinh(half4 v);
3770#endif
3771
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003772/*
3773 * native_asinpi: Approximate inverse sine divided by pi
3774 *
3775 * Returns the approximate inverse sine in radians, divided by pi.
3776 *
3777 * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
3778 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003779 * This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003780 *
3781 * See also asinpi().
3782 */
3783#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3784extern float __attribute__((const, overloadable))
3785 native_asinpi(float v);
3786#endif
3787
3788#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3789extern float2 __attribute__((const, overloadable))
3790 native_asinpi(float2 v);
3791#endif
3792
3793#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3794extern float3 __attribute__((const, overloadable))
3795 native_asinpi(float3 v);
3796#endif
3797
3798#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3799extern float4 __attribute__((const, overloadable))
3800 native_asinpi(float4 v);
3801#endif
3802
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003803#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3804extern half __attribute__((const, overloadable))
3805 native_asinpi(half v);
3806#endif
3807
3808#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3809extern half2 __attribute__((const, overloadable))
3810 native_asinpi(half2 v);
3811#endif
3812
3813#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3814extern half3 __attribute__((const, overloadable))
3815 native_asinpi(half3 v);
3816#endif
3817
3818#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3819extern half4 __attribute__((const, overloadable))
3820 native_asinpi(half4 v);
3821#endif
3822
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003823/*
3824 * native_atan: Approximate inverse tangent
3825 *
3826 * Returns the approximate inverse tangent, in radians.
3827 *
3828 * See also atan().
3829 */
3830#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3831extern float __attribute__((const, overloadable))
3832 native_atan(float v);
3833#endif
3834
3835#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3836extern float2 __attribute__((const, overloadable))
3837 native_atan(float2 v);
3838#endif
3839
3840#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3841extern float3 __attribute__((const, overloadable))
3842 native_atan(float3 v);
3843#endif
3844
3845#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3846extern float4 __attribute__((const, overloadable))
3847 native_atan(float4 v);
3848#endif
3849
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003850#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3851extern half __attribute__((const, overloadable))
3852 native_atan(half v);
3853#endif
3854
3855#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3856extern half2 __attribute__((const, overloadable))
3857 native_atan(half2 v);
3858#endif
3859
3860#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3861extern half3 __attribute__((const, overloadable))
3862 native_atan(half3 v);
3863#endif
3864
3865#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3866extern half4 __attribute__((const, overloadable))
3867 native_atan(half4 v);
3868#endif
3869
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003870/*
3871 * native_atan2: Approximate inverse tangent of a ratio
3872 *
3873 * Returns the approximate inverse tangent of (numerator / denominator), in radians.
3874 *
3875 * See also atan2().
3876 *
3877 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003878 * numerator: Numerator.
3879 * denominator: Denominator. Can be 0.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003880 */
3881#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3882extern float __attribute__((const, overloadable))
3883 native_atan2(float numerator, float denominator);
3884#endif
3885
3886#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3887extern float2 __attribute__((const, overloadable))
3888 native_atan2(float2 numerator, float2 denominator);
3889#endif
3890
3891#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3892extern float3 __attribute__((const, overloadable))
3893 native_atan2(float3 numerator, float3 denominator);
3894#endif
3895
3896#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3897extern float4 __attribute__((const, overloadable))
3898 native_atan2(float4 numerator, float4 denominator);
3899#endif
3900
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003901#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3902extern half __attribute__((const, overloadable))
3903 native_atan2(half numerator, half denominator);
3904#endif
3905
3906#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3907extern half2 __attribute__((const, overloadable))
3908 native_atan2(half2 numerator, half2 denominator);
3909#endif
3910
3911#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3912extern half3 __attribute__((const, overloadable))
3913 native_atan2(half3 numerator, half3 denominator);
3914#endif
3915
3916#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3917extern half4 __attribute__((const, overloadable))
3918 native_atan2(half4 numerator, half4 denominator);
3919#endif
3920
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003921/*
3922 * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi
3923 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003924 * Returns the approximate inverse tangent of (numerator / denominator),
3925 * in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003926 *
3927 * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
3928 *
3929 * See also atan2pi().
3930 *
3931 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003932 * numerator: Numerator.
3933 * denominator: Denominator. Can be 0.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003934 */
3935#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3936extern float __attribute__((const, overloadable))
3937 native_atan2pi(float numerator, float denominator);
3938#endif
3939
3940#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3941extern float2 __attribute__((const, overloadable))
3942 native_atan2pi(float2 numerator, float2 denominator);
3943#endif
3944
3945#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3946extern float3 __attribute__((const, overloadable))
3947 native_atan2pi(float3 numerator, float3 denominator);
3948#endif
3949
3950#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3951extern float4 __attribute__((const, overloadable))
3952 native_atan2pi(float4 numerator, float4 denominator);
3953#endif
3954
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08003955#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3956extern half __attribute__((const, overloadable))
3957 native_atan2pi(half numerator, half denominator);
3958#endif
3959
3960#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3961extern half2 __attribute__((const, overloadable))
3962 native_atan2pi(half2 numerator, half2 denominator);
3963#endif
3964
3965#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3966extern half3 __attribute__((const, overloadable))
3967 native_atan2pi(half3 numerator, half3 denominator);
3968#endif
3969
3970#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
3971extern half4 __attribute__((const, overloadable))
3972 native_atan2pi(half4 numerator, half4 denominator);
3973#endif
3974
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003975/*
3976 * native_atanh: Approximate inverse hyperbolic tangent
3977 *
3978 * Returns the approximate inverse hyperbolic tangent, in radians.
3979 *
3980 * See also atanh().
3981 */
3982#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3983extern float __attribute__((const, overloadable))
3984 native_atanh(float v);
3985#endif
3986
3987#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3988extern float2 __attribute__((const, overloadable))
3989 native_atanh(float2 v);
3990#endif
3991
3992#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3993extern float3 __attribute__((const, overloadable))
3994 native_atanh(float3 v);
3995#endif
3996
3997#if (defined(RS_VERSION) && (RS_VERSION >= 21))
3998extern float4 __attribute__((const, overloadable))
3999 native_atanh(float4 v);
4000#endif
4001
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004002#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4003extern half __attribute__((const, overloadable))
4004 native_atanh(half v);
4005#endif
4006
4007#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4008extern half2 __attribute__((const, overloadable))
4009 native_atanh(half2 v);
4010#endif
4011
4012#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4013extern half3 __attribute__((const, overloadable))
4014 native_atanh(half3 v);
4015#endif
4016
4017#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4018extern half4 __attribute__((const, overloadable))
4019 native_atanh(half4 v);
4020#endif
4021
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004022/*
4023 * native_atanpi: Approximate inverse tangent divided by pi
4024 *
4025 * Returns the approximate inverse tangent in radians, divided by pi.
4026 *
4027 * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
4028 *
4029 * See also atanpi().
4030 */
4031#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4032extern float __attribute__((const, overloadable))
4033 native_atanpi(float v);
4034#endif
4035
4036#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4037extern float2 __attribute__((const, overloadable))
4038 native_atanpi(float2 v);
4039#endif
4040
4041#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4042extern float3 __attribute__((const, overloadable))
4043 native_atanpi(float3 v);
4044#endif
4045
4046#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4047extern float4 __attribute__((const, overloadable))
4048 native_atanpi(float4 v);
4049#endif
4050
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004051#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4052extern half __attribute__((const, overloadable))
4053 native_atanpi(half v);
4054#endif
4055
4056#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4057extern half2 __attribute__((const, overloadable))
4058 native_atanpi(half2 v);
4059#endif
4060
4061#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4062extern half3 __attribute__((const, overloadable))
4063 native_atanpi(half3 v);
4064#endif
4065
4066#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4067extern half4 __attribute__((const, overloadable))
4068 native_atanpi(half4 v);
4069#endif
4070
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004071/*
4072 * native_cbrt: Approximate cube root
4073 *
4074 * Returns the approximate cubic root.
4075 *
4076 * See also cbrt().
4077 */
4078#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4079extern float __attribute__((const, overloadable))
4080 native_cbrt(float v);
4081#endif
4082
4083#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4084extern float2 __attribute__((const, overloadable))
4085 native_cbrt(float2 v);
4086#endif
4087
4088#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4089extern float3 __attribute__((const, overloadable))
4090 native_cbrt(float3 v);
4091#endif
4092
4093#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4094extern float4 __attribute__((const, overloadable))
4095 native_cbrt(float4 v);
4096#endif
4097
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004098#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4099extern half __attribute__((const, overloadable))
4100 native_cbrt(half v);
4101#endif
4102
4103#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4104extern half2 __attribute__((const, overloadable))
4105 native_cbrt(half2 v);
4106#endif
4107
4108#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4109extern half3 __attribute__((const, overloadable))
4110 native_cbrt(half3 v);
4111#endif
4112
4113#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4114extern half4 __attribute__((const, overloadable))
4115 native_cbrt(half4 v);
4116#endif
4117
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004118/*
4119 * native_cos: Approximate cosine
4120 *
4121 * Returns the approximate cosine of an angle measured in radians.
4122 *
4123 * See also cos().
4124 */
4125#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4126extern float __attribute__((const, overloadable))
4127 native_cos(float v);
4128#endif
4129
4130#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4131extern float2 __attribute__((const, overloadable))
4132 native_cos(float2 v);
4133#endif
4134
4135#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4136extern float3 __attribute__((const, overloadable))
4137 native_cos(float3 v);
4138#endif
4139
4140#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4141extern float4 __attribute__((const, overloadable))
4142 native_cos(float4 v);
4143#endif
4144
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004145#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4146extern half __attribute__((const, overloadable))
4147 native_cos(half v);
4148#endif
4149
4150#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4151extern half2 __attribute__((const, overloadable))
4152 native_cos(half2 v);
4153#endif
4154
4155#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4156extern half3 __attribute__((const, overloadable))
4157 native_cos(half3 v);
4158#endif
4159
4160#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4161extern half4 __attribute__((const, overloadable))
4162 native_cos(half4 v);
4163#endif
4164
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004165/*
4166 * native_cosh: Approximate hypebolic cosine
4167 *
4168 * Returns the approximate hypebolic cosine.
4169 *
4170 * See also cosh().
4171 */
4172#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4173extern float __attribute__((const, overloadable))
4174 native_cosh(float v);
4175#endif
4176
4177#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4178extern float2 __attribute__((const, overloadable))
4179 native_cosh(float2 v);
4180#endif
4181
4182#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4183extern float3 __attribute__((const, overloadable))
4184 native_cosh(float3 v);
4185#endif
4186
4187#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4188extern float4 __attribute__((const, overloadable))
4189 native_cosh(float4 v);
4190#endif
4191
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004192#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4193extern half __attribute__((const, overloadable))
4194 native_cosh(half v);
4195#endif
4196
4197#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4198extern half2 __attribute__((const, overloadable))
4199 native_cosh(half2 v);
4200#endif
4201
4202#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4203extern half3 __attribute__((const, overloadable))
4204 native_cosh(half3 v);
4205#endif
4206
4207#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4208extern half4 __attribute__((const, overloadable))
4209 native_cosh(half4 v);
4210#endif
4211
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004212/*
4213 * native_cospi: Approximate cosine of a number multiplied by pi
4214 *
4215 * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
4216 *
4217 * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
4218 *
4219 * See also cospi().
4220 */
4221#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4222extern float __attribute__((const, overloadable))
4223 native_cospi(float v);
4224#endif
4225
4226#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4227extern float2 __attribute__((const, overloadable))
4228 native_cospi(float2 v);
4229#endif
4230
4231#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4232extern float3 __attribute__((const, overloadable))
4233 native_cospi(float3 v);
4234#endif
4235
4236#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4237extern float4 __attribute__((const, overloadable))
4238 native_cospi(float4 v);
4239#endif
4240
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004241#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4242extern half __attribute__((const, overloadable))
4243 native_cospi(half v);
4244#endif
4245
4246#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4247extern half2 __attribute__((const, overloadable))
4248 native_cospi(half2 v);
4249#endif
4250
4251#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4252extern half3 __attribute__((const, overloadable))
4253 native_cospi(half3 v);
4254#endif
4255
4256#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4257extern half4 __attribute__((const, overloadable))
4258 native_cospi(half4 v);
4259#endif
4260
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004261/*
4262 * native_divide: Approximate division
4263 *
4264 * Computes the approximate division of two values.
4265 */
4266#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4267extern float __attribute__((const, overloadable))
4268 native_divide(float left_vector, float right_vector);
4269#endif
4270
4271#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4272extern float2 __attribute__((const, overloadable))
4273 native_divide(float2 left_vector, float2 right_vector);
4274#endif
4275
4276#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4277extern float3 __attribute__((const, overloadable))
4278 native_divide(float3 left_vector, float3 right_vector);
4279#endif
4280
4281#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4282extern float4 __attribute__((const, overloadable))
4283 native_divide(float4 left_vector, float4 right_vector);
4284#endif
4285
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004286#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4287extern half __attribute__((const, overloadable))
4288 native_divide(half left_vector, half right_vector);
4289#endif
4290
4291#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4292extern half2 __attribute__((const, overloadable))
4293 native_divide(half2 left_vector, half2 right_vector);
4294#endif
4295
4296#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4297extern half3 __attribute__((const, overloadable))
4298 native_divide(half3 left_vector, half3 right_vector);
4299#endif
4300
4301#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4302extern half4 __attribute__((const, overloadable))
4303 native_divide(half4 left_vector, half4 right_vector);
4304#endif
4305
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004306/*
4307 * native_exp: Approximate e raised to a number
4308 *
4309 * Fast approximate exp.
4310 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004311 * It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
4312 * expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004313 *
4314 * See also exp().
4315 */
4316#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4317extern float __attribute__((const, overloadable))
4318 native_exp(float v);
4319#endif
4320
4321#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4322extern float2 __attribute__((const, overloadable))
4323 native_exp(float2 v);
4324#endif
4325
4326#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4327extern float3 __attribute__((const, overloadable))
4328 native_exp(float3 v);
4329#endif
4330
4331#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4332extern float4 __attribute__((const, overloadable))
4333 native_exp(float4 v);
4334#endif
4335
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004336#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4337extern half __attribute__((const, overloadable))
4338 native_exp(half v);
4339#endif
4340
4341#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4342extern half2 __attribute__((const, overloadable))
4343 native_exp(half2 v);
4344#endif
4345
4346#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4347extern half3 __attribute__((const, overloadable))
4348 native_exp(half3 v);
4349#endif
4350
4351#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4352extern half4 __attribute__((const, overloadable))
4353 native_exp(half4 v);
4354#endif
4355
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004356/*
4357 * native_exp10: Approximate 10 raised to a number
4358 *
4359 * Fast approximate exp10.
4360 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004361 * It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
4362 * expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004363 *
4364 * See also exp10().
4365 */
4366#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4367extern float __attribute__((const, overloadable))
4368 native_exp10(float v);
4369#endif
4370
4371#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4372extern float2 __attribute__((const, overloadable))
4373 native_exp10(float2 v);
4374#endif
4375
4376#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4377extern float3 __attribute__((const, overloadable))
4378 native_exp10(float3 v);
4379#endif
4380
4381#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4382extern float4 __attribute__((const, overloadable))
4383 native_exp10(float4 v);
4384#endif
4385
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004386#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4387extern half __attribute__((const, overloadable))
4388 native_exp10(half v);
4389#endif
4390
4391#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4392extern half2 __attribute__((const, overloadable))
4393 native_exp10(half2 v);
4394#endif
4395
4396#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4397extern half3 __attribute__((const, overloadable))
4398 native_exp10(half3 v);
4399#endif
4400
4401#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4402extern half4 __attribute__((const, overloadable))
4403 native_exp10(half4 v);
4404#endif
4405
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004406/*
4407 * native_exp2: Approximate 2 raised to a number
4408 *
4409 * Fast approximate exp2.
4410 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004411 * It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
4412 * expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004413 *
4414 * See also exp2().
4415 */
4416#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4417extern float __attribute__((const, overloadable))
4418 native_exp2(float v);
4419#endif
4420
4421#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4422extern float2 __attribute__((const, overloadable))
4423 native_exp2(float2 v);
4424#endif
4425
4426#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4427extern float3 __attribute__((const, overloadable))
4428 native_exp2(float3 v);
4429#endif
4430
4431#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4432extern float4 __attribute__((const, overloadable))
4433 native_exp2(float4 v);
4434#endif
4435
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004436#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4437extern half __attribute__((const, overloadable))
4438 native_exp2(half v);
4439#endif
4440
4441#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4442extern half2 __attribute__((const, overloadable))
4443 native_exp2(half2 v);
4444#endif
4445
4446#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4447extern half3 __attribute__((const, overloadable))
4448 native_exp2(half3 v);
4449#endif
4450
4451#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4452extern half4 __attribute__((const, overloadable))
4453 native_exp2(half4 v);
4454#endif
4455
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004456/*
4457 * native_expm1: Approximate e raised to a number minus one
4458 *
4459 * Returns the approximate (e ^ v) - 1.
4460 *
4461 * See also expm1().
4462 */
4463#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4464extern float __attribute__((const, overloadable))
4465 native_expm1(float v);
4466#endif
4467
4468#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4469extern float2 __attribute__((const, overloadable))
4470 native_expm1(float2 v);
4471#endif
4472
4473#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4474extern float3 __attribute__((const, overloadable))
4475 native_expm1(float3 v);
4476#endif
4477
4478#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4479extern float4 __attribute__((const, overloadable))
4480 native_expm1(float4 v);
4481#endif
4482
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004483#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4484extern half __attribute__((const, overloadable))
4485 native_expm1(half v);
4486#endif
4487
4488#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4489extern half2 __attribute__((const, overloadable))
4490 native_expm1(half2 v);
4491#endif
4492
4493#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4494extern half3 __attribute__((const, overloadable))
4495 native_expm1(half3 v);
4496#endif
4497
4498#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4499extern half4 __attribute__((const, overloadable))
4500 native_expm1(half4 v);
4501#endif
4502
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004503/*
4504 * native_hypot: Approximate hypotenuse
4505 *
4506 * Returns the approximate native_sqrt(a * a + b * b)
4507 *
4508 * See also hypot().
4509 */
4510#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4511extern float __attribute__((const, overloadable))
4512 native_hypot(float a, float b);
4513#endif
4514
4515#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4516extern float2 __attribute__((const, overloadable))
4517 native_hypot(float2 a, float2 b);
4518#endif
4519
4520#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4521extern float3 __attribute__((const, overloadable))
4522 native_hypot(float3 a, float3 b);
4523#endif
4524
4525#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4526extern float4 __attribute__((const, overloadable))
4527 native_hypot(float4 a, float4 b);
4528#endif
4529
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004530#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4531extern half __attribute__((const, overloadable))
4532 native_hypot(half a, half b);
4533#endif
4534
4535#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4536extern half2 __attribute__((const, overloadable))
4537 native_hypot(half2 a, half2 b);
4538#endif
4539
4540#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4541extern half3 __attribute__((const, overloadable))
4542 native_hypot(half3 a, half3 b);
4543#endif
4544
4545#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4546extern half4 __attribute__((const, overloadable))
4547 native_hypot(half4 a, half4 b);
4548#endif
4549
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004550/*
4551 * native_log: Approximate natural logarithm
4552 *
4553 * Fast approximate log.
4554 *
4555 * It is not accurate for values very close to zero.
4556 *
4557 * See also log().
4558 */
4559#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4560extern float __attribute__((const, overloadable))
4561 native_log(float v);
4562#endif
4563
4564#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4565extern float2 __attribute__((const, overloadable))
4566 native_log(float2 v);
4567#endif
4568
4569#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4570extern float3 __attribute__((const, overloadable))
4571 native_log(float3 v);
4572#endif
4573
4574#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4575extern float4 __attribute__((const, overloadable))
4576 native_log(float4 v);
4577#endif
4578
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004579#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4580extern half __attribute__((const, overloadable))
4581 native_log(half v);
4582#endif
4583
4584#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4585extern half2 __attribute__((const, overloadable))
4586 native_log(half2 v);
4587#endif
4588
4589#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4590extern half3 __attribute__((const, overloadable))
4591 native_log(half3 v);
4592#endif
4593
4594#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4595extern half4 __attribute__((const, overloadable))
4596 native_log(half4 v);
4597#endif
4598
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004599/*
4600 * native_log10: Approximate base 10 logarithm
4601 *
4602 * Fast approximate log10.
4603 *
4604 * It is not accurate for values very close to zero.
4605 *
4606 * See also log10().
4607 */
4608#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4609extern float __attribute__((const, overloadable))
4610 native_log10(float v);
4611#endif
4612
4613#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4614extern float2 __attribute__((const, overloadable))
4615 native_log10(float2 v);
4616#endif
4617
4618#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4619extern float3 __attribute__((const, overloadable))
4620 native_log10(float3 v);
4621#endif
4622
4623#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4624extern float4 __attribute__((const, overloadable))
4625 native_log10(float4 v);
4626#endif
4627
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004628#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4629extern half __attribute__((const, overloadable))
4630 native_log10(half v);
4631#endif
4632
4633#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4634extern half2 __attribute__((const, overloadable))
4635 native_log10(half2 v);
4636#endif
4637
4638#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4639extern half3 __attribute__((const, overloadable))
4640 native_log10(half3 v);
4641#endif
4642
4643#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4644extern half4 __attribute__((const, overloadable))
4645 native_log10(half4 v);
4646#endif
4647
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004648/*
4649 * native_log1p: Approximate natural logarithm of a value plus 1
4650 *
4651 * Returns the approximate natural logarithm of (v + 1.0f)
4652 *
4653 * See also log1p().
4654 */
4655#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4656extern float __attribute__((const, overloadable))
4657 native_log1p(float v);
4658#endif
4659
4660#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4661extern float2 __attribute__((const, overloadable))
4662 native_log1p(float2 v);
4663#endif
4664
4665#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4666extern float3 __attribute__((const, overloadable))
4667 native_log1p(float3 v);
4668#endif
4669
4670#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4671extern float4 __attribute__((const, overloadable))
4672 native_log1p(float4 v);
4673#endif
4674
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004675#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4676extern half __attribute__((const, overloadable))
4677 native_log1p(half v);
4678#endif
4679
4680#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4681extern half2 __attribute__((const, overloadable))
4682 native_log1p(half2 v);
4683#endif
4684
4685#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4686extern half3 __attribute__((const, overloadable))
4687 native_log1p(half3 v);
4688#endif
4689
4690#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4691extern half4 __attribute__((const, overloadable))
4692 native_log1p(half4 v);
4693#endif
4694
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004695/*
4696 * native_log2: Approximate base 2 logarithm
4697 *
4698 * Fast approximate log2.
4699 *
4700 * It is not accurate for values very close to zero.
4701 *
4702 * See also log2().
4703 */
4704#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4705extern float __attribute__((const, overloadable))
4706 native_log2(float v);
4707#endif
4708
4709#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4710extern float2 __attribute__((const, overloadable))
4711 native_log2(float2 v);
4712#endif
4713
4714#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4715extern float3 __attribute__((const, overloadable))
4716 native_log2(float3 v);
4717#endif
4718
4719#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4720extern float4 __attribute__((const, overloadable))
4721 native_log2(float4 v);
4722#endif
4723
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004724#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4725extern half __attribute__((const, overloadable))
4726 native_log2(half v);
4727#endif
4728
4729#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4730extern half2 __attribute__((const, overloadable))
4731 native_log2(half2 v);
4732#endif
4733
4734#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4735extern half3 __attribute__((const, overloadable))
4736 native_log2(half3 v);
4737#endif
4738
4739#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4740extern half4 __attribute__((const, overloadable))
4741 native_log2(half4 v);
4742#endif
4743
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004744/*
4745 * native_powr: Approximate positive base raised to an exponent
4746 *
4747 * Fast approximate (base ^ exponent).
4748 *
4749 * See also powr().
4750 *
4751 * Parameters:
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07004752 * base: Must be between 0.f and 256.f. The function is not accurate for values very close to zero.
4753 * exponent: Must be between -15.f and 15.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004754 */
4755#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4756extern float __attribute__((const, overloadable))
4757 native_powr(float base, float exponent);
4758#endif
4759
4760#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4761extern float2 __attribute__((const, overloadable))
4762 native_powr(float2 base, float2 exponent);
4763#endif
4764
4765#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4766extern float3 __attribute__((const, overloadable))
4767 native_powr(float3 base, float3 exponent);
4768#endif
4769
4770#if (defined(RS_VERSION) && (RS_VERSION >= 18))
4771extern float4 __attribute__((const, overloadable))
4772 native_powr(float4 base, float4 exponent);
4773#endif
4774
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004775#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4776extern half __attribute__((const, overloadable))
4777 native_powr(half base, half exponent);
4778#endif
4779
4780#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4781extern half2 __attribute__((const, overloadable))
4782 native_powr(half2 base, half2 exponent);
4783#endif
4784
4785#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4786extern half3 __attribute__((const, overloadable))
4787 native_powr(half3 base, half3 exponent);
4788#endif
4789
4790#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4791extern half4 __attribute__((const, overloadable))
4792 native_powr(half4 base, half4 exponent);
4793#endif
4794
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004795/*
4796 * native_recip: Approximate reciprocal
4797 *
4798 * Returns the approximate approximate reciprocal of a value.
4799 *
4800 * See also half_recip().
4801 */
4802#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4803extern float __attribute__((const, overloadable))
4804 native_recip(float v);
4805#endif
4806
4807#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4808extern float2 __attribute__((const, overloadable))
4809 native_recip(float2 v);
4810#endif
4811
4812#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4813extern float3 __attribute__((const, overloadable))
4814 native_recip(float3 v);
4815#endif
4816
4817#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4818extern float4 __attribute__((const, overloadable))
4819 native_recip(float4 v);
4820#endif
4821
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004822#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4823extern half __attribute__((const, overloadable))
4824 native_recip(half v);
4825#endif
4826
4827#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4828extern half2 __attribute__((const, overloadable))
4829 native_recip(half2 v);
4830#endif
4831
4832#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4833extern half3 __attribute__((const, overloadable))
4834 native_recip(half3 v);
4835#endif
4836
4837#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4838extern half4 __attribute__((const, overloadable))
4839 native_recip(half4 v);
4840#endif
4841
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004842/*
4843 * native_rootn: Approximate nth root
4844 *
4845 * Compute the approximate Nth root of a value.
4846 *
4847 * See also rootn().
4848 */
4849#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4850extern float __attribute__((const, overloadable))
4851 native_rootn(float v, int n);
4852#endif
4853
4854#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4855extern float2 __attribute__((const, overloadable))
4856 native_rootn(float2 v, int2 n);
4857#endif
4858
4859#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4860extern float3 __attribute__((const, overloadable))
4861 native_rootn(float3 v, int3 n);
4862#endif
4863
4864#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4865extern float4 __attribute__((const, overloadable))
4866 native_rootn(float4 v, int4 n);
4867#endif
4868
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004869#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4870extern half __attribute__((const, overloadable))
4871 native_rootn(half v, int n);
4872#endif
4873
4874#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4875extern half2 __attribute__((const, overloadable))
4876 native_rootn(half2 v, int2 n);
4877#endif
4878
4879#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4880extern half3 __attribute__((const, overloadable))
4881 native_rootn(half3 v, int3 n);
4882#endif
4883
4884#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4885extern half4 __attribute__((const, overloadable))
4886 native_rootn(half4 v, int4 n);
4887#endif
4888
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004889/*
4890 * native_rsqrt: Approximate reciprocal of a square root
4891 *
4892 * Returns approximate (1 / sqrt(v)).
4893 *
4894 * See also rsqrt(), half_rsqrt().
4895 */
4896#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4897extern float __attribute__((const, overloadable))
4898 native_rsqrt(float v);
4899#endif
4900
4901#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4902extern float2 __attribute__((const, overloadable))
4903 native_rsqrt(float2 v);
4904#endif
4905
4906#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4907extern float3 __attribute__((const, overloadable))
4908 native_rsqrt(float3 v);
4909#endif
4910
4911#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4912extern float4 __attribute__((const, overloadable))
4913 native_rsqrt(float4 v);
4914#endif
4915
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004916#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4917extern half __attribute__((const, overloadable))
4918 native_rsqrt(half v);
4919#endif
4920
4921#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4922extern half2 __attribute__((const, overloadable))
4923 native_rsqrt(half2 v);
4924#endif
4925
4926#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4927extern half3 __attribute__((const, overloadable))
4928 native_rsqrt(half3 v);
4929#endif
4930
4931#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4932extern half4 __attribute__((const, overloadable))
4933 native_rsqrt(half4 v);
4934#endif
4935
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004936/*
4937 * native_sin: Approximate sine
4938 *
4939 * Returns the approximate sine of an angle measured in radians.
4940 *
4941 * See also sin().
4942 */
4943#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4944extern float __attribute__((const, overloadable))
4945 native_sin(float v);
4946#endif
4947
4948#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4949extern float2 __attribute__((const, overloadable))
4950 native_sin(float2 v);
4951#endif
4952
4953#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4954extern float3 __attribute__((const, overloadable))
4955 native_sin(float3 v);
4956#endif
4957
4958#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4959extern float4 __attribute__((const, overloadable))
4960 native_sin(float4 v);
4961#endif
4962
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08004963#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4964extern half __attribute__((const, overloadable))
4965 native_sin(half v);
4966#endif
4967
4968#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4969extern half2 __attribute__((const, overloadable))
4970 native_sin(half2 v);
4971#endif
4972
4973#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4974extern half3 __attribute__((const, overloadable))
4975 native_sin(half3 v);
4976#endif
4977
4978#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
4979extern half4 __attribute__((const, overloadable))
4980 native_sin(half4 v);
4981#endif
4982
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004983/*
4984 * native_sincos: Approximate sine and cosine
4985 *
4986 * Returns the approximate sine and cosine of a value.
4987 *
4988 * See also sincos().
4989 *
4990 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004991 * v: Incoming value in radians.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07004992 * cos: *cos will be set to the cosine value.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004993 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07004994 * Returns: Sine.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07004995 */
4996#if (defined(RS_VERSION) && (RS_VERSION >= 21))
4997extern float __attribute__((overloadable))
4998 native_sincos(float v, float* cos);
4999#endif
5000
5001#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5002extern float2 __attribute__((overloadable))
5003 native_sincos(float2 v, float2* cos);
5004#endif
5005
5006#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5007extern float3 __attribute__((overloadable))
5008 native_sincos(float3 v, float3* cos);
5009#endif
5010
5011#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5012extern float4 __attribute__((overloadable))
5013 native_sincos(float4 v, float4* cos);
5014#endif
5015
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005016#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5017extern half __attribute__((overloadable))
5018 native_sincos(half v, half* cos);
5019#endif
5020
5021#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5022extern half2 __attribute__((overloadable))
5023 native_sincos(half2 v, half2* cos);
5024#endif
5025
5026#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5027extern half3 __attribute__((overloadable))
5028 native_sincos(half3 v, half3* cos);
5029#endif
5030
5031#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5032extern half4 __attribute__((overloadable))
5033 native_sincos(half4 v, half4* cos);
5034#endif
5035
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005036/*
5037 * native_sinh: Approximate hyperbolic sine
5038 *
5039 * Returns the approximate hyperbolic sine of a value specified in radians.
5040 *
5041 * See also sinh().
5042 */
5043#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5044extern float __attribute__((const, overloadable))
5045 native_sinh(float v);
5046#endif
5047
5048#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5049extern float2 __attribute__((const, overloadable))
5050 native_sinh(float2 v);
5051#endif
5052
5053#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5054extern float3 __attribute__((const, overloadable))
5055 native_sinh(float3 v);
5056#endif
5057
5058#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5059extern float4 __attribute__((const, overloadable))
5060 native_sinh(float4 v);
5061#endif
5062
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005063#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5064extern half __attribute__((const, overloadable))
5065 native_sinh(half v);
5066#endif
5067
5068#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5069extern half2 __attribute__((const, overloadable))
5070 native_sinh(half2 v);
5071#endif
5072
5073#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5074extern half3 __attribute__((const, overloadable))
5075 native_sinh(half3 v);
5076#endif
5077
5078#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5079extern half4 __attribute__((const, overloadable))
5080 native_sinh(half4 v);
5081#endif
5082
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005083/*
5084 * native_sinpi: Approximate sine of a number multiplied by pi
5085 *
5086 * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
5087 *
5088 * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
5089 *
5090 * See also sinpi().
5091 */
5092#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5093extern float __attribute__((const, overloadable))
5094 native_sinpi(float v);
5095#endif
5096
5097#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5098extern float2 __attribute__((const, overloadable))
5099 native_sinpi(float2 v);
5100#endif
5101
5102#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5103extern float3 __attribute__((const, overloadable))
5104 native_sinpi(float3 v);
5105#endif
5106
5107#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5108extern float4 __attribute__((const, overloadable))
5109 native_sinpi(float4 v);
5110#endif
5111
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005112#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5113extern half __attribute__((const, overloadable))
5114 native_sinpi(half v);
5115#endif
5116
5117#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5118extern half2 __attribute__((const, overloadable))
5119 native_sinpi(half2 v);
5120#endif
5121
5122#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5123extern half3 __attribute__((const, overloadable))
5124 native_sinpi(half3 v);
5125#endif
5126
5127#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5128extern half4 __attribute__((const, overloadable))
5129 native_sinpi(half4 v);
5130#endif
5131
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005132/*
5133 * native_sqrt: Approximate square root
5134 *
5135 * Returns the approximate sqrt(v).
5136 *
5137 * See also sqrt(), half_sqrt().
5138 */
5139#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5140extern float __attribute__((const, overloadable))
5141 native_sqrt(float v);
5142#endif
5143
5144#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5145extern float2 __attribute__((const, overloadable))
5146 native_sqrt(float2 v);
5147#endif
5148
5149#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5150extern float3 __attribute__((const, overloadable))
5151 native_sqrt(float3 v);
5152#endif
5153
5154#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5155extern float4 __attribute__((const, overloadable))
5156 native_sqrt(float4 v);
5157#endif
5158
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005159#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5160extern half __attribute__((const, overloadable))
5161 native_sqrt(half v);
5162#endif
5163
5164#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5165extern half2 __attribute__((const, overloadable))
5166 native_sqrt(half2 v);
5167#endif
5168
5169#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5170extern half3 __attribute__((const, overloadable))
5171 native_sqrt(half3 v);
5172#endif
5173
5174#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5175extern half4 __attribute__((const, overloadable))
5176 native_sqrt(half4 v);
5177#endif
5178
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005179/*
5180 * native_tan: Approximate tangent
5181 *
5182 * Returns the approximate tangent of an angle measured in radians.
5183 */
5184#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5185extern float __attribute__((const, overloadable))
5186 native_tan(float v);
5187#endif
5188
5189#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5190extern float2 __attribute__((const, overloadable))
5191 native_tan(float2 v);
5192#endif
5193
5194#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5195extern float3 __attribute__((const, overloadable))
5196 native_tan(float3 v);
5197#endif
5198
5199#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5200extern float4 __attribute__((const, overloadable))
5201 native_tan(float4 v);
5202#endif
5203
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005204#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5205extern half __attribute__((const, overloadable))
5206 native_tan(half v);
5207#endif
5208
5209#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5210extern half2 __attribute__((const, overloadable))
5211 native_tan(half2 v);
5212#endif
5213
5214#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5215extern half3 __attribute__((const, overloadable))
5216 native_tan(half3 v);
5217#endif
5218
5219#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5220extern half4 __attribute__((const, overloadable))
5221 native_tan(half4 v);
5222#endif
5223
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005224/*
5225 * native_tanh: Approximate hyperbolic tangent
5226 *
5227 * Returns the approximate hyperbolic tangent of a value.
5228 *
5229 * See also tanh().
5230 */
5231#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5232extern float __attribute__((const, overloadable))
5233 native_tanh(float v);
5234#endif
5235
5236#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5237extern float2 __attribute__((const, overloadable))
5238 native_tanh(float2 v);
5239#endif
5240
5241#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5242extern float3 __attribute__((const, overloadable))
5243 native_tanh(float3 v);
5244#endif
5245
5246#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5247extern float4 __attribute__((const, overloadable))
5248 native_tanh(float4 v);
5249#endif
5250
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005251#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5252extern half __attribute__((const, overloadable))
5253 native_tanh(half v);
5254#endif
5255
5256#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5257extern half2 __attribute__((const, overloadable))
5258 native_tanh(half2 v);
5259#endif
5260
5261#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5262extern half3 __attribute__((const, overloadable))
5263 native_tanh(half3 v);
5264#endif
5265
5266#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5267extern half4 __attribute__((const, overloadable))
5268 native_tanh(half4 v);
5269#endif
5270
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005271/*
5272 * native_tanpi: Approximate tangent of a number multiplied by pi
5273 *
5274 * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
5275 *
5276 * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
5277 *
5278 * See also tanpi().
5279 */
5280#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5281extern float __attribute__((const, overloadable))
5282 native_tanpi(float v);
5283#endif
5284
5285#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5286extern float2 __attribute__((const, overloadable))
5287 native_tanpi(float2 v);
5288#endif
5289
5290#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5291extern float3 __attribute__((const, overloadable))
5292 native_tanpi(float3 v);
5293#endif
5294
5295#if (defined(RS_VERSION) && (RS_VERSION >= 21))
5296extern float4 __attribute__((const, overloadable))
5297 native_tanpi(float4 v);
5298#endif
5299
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005300#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5301extern half __attribute__((const, overloadable))
5302 native_tanpi(half v);
5303#endif
5304
5305#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5306extern half2 __attribute__((const, overloadable))
5307 native_tanpi(half2 v);
5308#endif
5309
5310#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5311extern half3 __attribute__((const, overloadable))
5312 native_tanpi(half3 v);
5313#endif
5314
5315#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5316extern half4 __attribute__((const, overloadable))
5317 native_tanpi(half4 v);
5318#endif
5319
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005320/*
5321 * nextafter: Next floating point number
5322 *
5323 * Returns the next representable floating point number from v towards target.
5324 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005325 * In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
5326 * value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005327 */
5328extern float __attribute__((const, overloadable))
5329 nextafter(float v, float target);
5330
5331extern float2 __attribute__((const, overloadable))
5332 nextafter(float2 v, float2 target);
5333
5334extern float3 __attribute__((const, overloadable))
5335 nextafter(float3 v, float3 target);
5336
5337extern float4 __attribute__((const, overloadable))
5338 nextafter(float4 v, float4 target);
5339
5340/*
5341 * pow: Base raised to an exponent
5342 *
5343 * Returns base raised to the power exponent, i.e. base ^ exponent.
5344 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005345 * pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the
5346 * base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005347 */
5348extern float __attribute__((const, overloadable))
5349 pow(float base, float exponent);
5350
5351extern float2 __attribute__((const, overloadable))
5352 pow(float2 base, float2 exponent);
5353
5354extern float3 __attribute__((const, overloadable))
5355 pow(float3 base, float3 exponent);
5356
5357extern float4 __attribute__((const, overloadable))
5358 pow(float4 base, float4 exponent);
5359
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005360#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5361extern half __attribute__((const, overloadable))
5362 pow(half base, half exponent);
5363#endif
5364
5365#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5366extern half2 __attribute__((const, overloadable))
5367 pow(half2 base, half2 exponent);
5368#endif
5369
5370#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5371extern half3 __attribute__((const, overloadable))
5372 pow(half3 base, half3 exponent);
5373#endif
5374
5375#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5376extern half4 __attribute__((const, overloadable))
5377 pow(half4 base, half4 exponent);
5378#endif
5379
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005380/*
5381 * pown: Base raised to an integer exponent
5382 *
5383 * Returns base raised to the power exponent, i.e. base ^ exponent.
5384 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005385 * pow() and powr() are similar. The both take a float exponent. powr() also assumes the
5386 * base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005387 */
5388extern float __attribute__((const, overloadable))
5389 pown(float base, int exponent);
5390
5391extern float2 __attribute__((const, overloadable))
5392 pown(float2 base, int2 exponent);
5393
5394extern float3 __attribute__((const, overloadable))
5395 pown(float3 base, int3 exponent);
5396
5397extern float4 __attribute__((const, overloadable))
5398 pown(float4 base, int4 exponent);
5399
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005400#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5401extern half __attribute__((const, overloadable))
5402 pown(half base, int exponent);
5403#endif
5404
5405#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5406extern half2 __attribute__((const, overloadable))
5407 pown(half2 base, int2 exponent);
5408#endif
5409
5410#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5411extern half3 __attribute__((const, overloadable))
5412 pown(half3 base, int3 exponent);
5413#endif
5414
5415#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5416extern half4 __attribute__((const, overloadable))
5417 pown(half4 base, int4 exponent);
5418#endif
5419
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005420/*
5421 * powr: Positive base raised to an exponent
5422 *
5423 * Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0.
5424 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005425 * pow() and pown() are similar. They both make no assumptions about the base.
5426 * pow() takes a float exponent while pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005427 *
5428 * See also native_powr().
5429 */
5430extern float __attribute__((const, overloadable))
5431 powr(float base, float exponent);
5432
5433extern float2 __attribute__((const, overloadable))
5434 powr(float2 base, float2 exponent);
5435
5436extern float3 __attribute__((const, overloadable))
5437 powr(float3 base, float3 exponent);
5438
5439extern float4 __attribute__((const, overloadable))
5440 powr(float4 base, float4 exponent);
5441
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005442#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5443extern half __attribute__((const, overloadable))
5444 powr(half base, half exponent);
5445#endif
5446
5447#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5448extern half2 __attribute__((const, overloadable))
5449 powr(half2 base, half2 exponent);
5450#endif
5451
5452#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5453extern half3 __attribute__((const, overloadable))
5454 powr(half3 base, half3 exponent);
5455#endif
5456
5457#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5458extern half4 __attribute__((const, overloadable))
5459 powr(half4 base, half4 exponent);
5460#endif
5461
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005462/*
5463 * radians: Converts degrees into radians
5464 *
5465 * Converts from degrees to radians.
5466 */
5467extern float __attribute__((const, overloadable))
5468 radians(float v);
5469
5470extern float2 __attribute__((const, overloadable))
5471 radians(float2 v);
5472
5473extern float3 __attribute__((const, overloadable))
5474 radians(float3 v);
5475
5476extern float4 __attribute__((const, overloadable))
5477 radians(float4 v);
5478
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005479#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5480extern half __attribute__((const, overloadable))
5481 radians(half v);
5482#endif
5483
5484#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5485extern half2 __attribute__((const, overloadable))
5486 radians(half2 v);
5487#endif
5488
5489#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5490extern half3 __attribute__((const, overloadable))
5491 radians(half3 v);
5492#endif
5493
5494#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5495extern half4 __attribute__((const, overloadable))
5496 radians(half4 v);
5497#endif
5498
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005499/*
5500 * remainder: Remainder of a division
5501 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005502 * Returns the remainder of (numerator / denominator), where the quotient is rounded towards
5503 * the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005504 *
5505 * The function fmod() is similar but rounds toward the closest interger.
5506 * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
5507 * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
5508 */
5509extern float __attribute__((const, overloadable))
5510 remainder(float numerator, float denominator);
5511
5512extern float2 __attribute__((const, overloadable))
5513 remainder(float2 numerator, float2 denominator);
5514
5515extern float3 __attribute__((const, overloadable))
5516 remainder(float3 numerator, float3 denominator);
5517
5518extern float4 __attribute__((const, overloadable))
5519 remainder(float4 numerator, float4 denominator);
5520
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005521#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5522extern half __attribute__((const, overloadable))
5523 remainder(half numerator, half denominator);
5524#endif
5525
5526#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5527extern half2 __attribute__((const, overloadable))
5528 remainder(half2 numerator, half2 denominator);
5529#endif
5530
5531#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5532extern half3 __attribute__((const, overloadable))
5533 remainder(half3 numerator, half3 denominator);
5534#endif
5535
5536#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5537extern half4 __attribute__((const, overloadable))
5538 remainder(half4 numerator, half4 denominator);
5539#endif
5540
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005541/*
5542 * remquo: Remainder and quotient of a division
5543 *
5544 * Returns the quotient and the remainder of (numerator / denominator).
5545 *
5546 * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
5547 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005548 * This function is useful for implementing periodic functions. The low three bits of the
5549 * quotient gives the quadrant and the remainder the distance within the quadrant.
5550 * For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant)
5551 * to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005552 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005553 * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3
5554 * and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005555 *
5556 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005557 * numerator: Numerator.
5558 * denominator: Denominator.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07005559 * quotient: *quotient will be set to the integer quotient.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005560 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005561 * Returns: Remainder, precise only for the low three bits.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005562 */
5563extern float __attribute__((overloadable))
5564 remquo(float numerator, float denominator, int* quotient);
5565
5566extern float2 __attribute__((overloadable))
5567 remquo(float2 numerator, float2 denominator, int2* quotient);
5568
5569extern float3 __attribute__((overloadable))
5570 remquo(float3 numerator, float3 denominator, int3* quotient);
5571
5572extern float4 __attribute__((overloadable))
5573 remquo(float4 numerator, float4 denominator, int4* quotient);
5574
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005575#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5576extern half __attribute__((overloadable))
5577 remquo(half numerator, half denominator, int* quotient);
5578#endif
5579
5580#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5581extern half2 __attribute__((overloadable))
5582 remquo(half2 numerator, half2 denominator, int2* quotient);
5583#endif
5584
5585#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5586extern half3 __attribute__((overloadable))
5587 remquo(half3 numerator, half3 denominator, int3* quotient);
5588#endif
5589
5590#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5591extern half4 __attribute__((overloadable))
5592 remquo(half4 numerator, half4 denominator, int4* quotient);
5593#endif
5594
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005595/*
5596 * rint: Round to even
5597 *
5598 * Rounds to the nearest integral value.
5599 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005600 * rint() rounds half values to even. For example, rint(0.5f) returns 0.f and
5601 * rint(1.5f) returns 2.f. Similarly, rint(-0.5f) returns -0.f and
5602 * rint(-1.5f) returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005603 *
5604 * round() is similar but rounds away from zero. trunc() truncates the decimal fraction.
5605 */
5606extern float __attribute__((const, overloadable))
5607 rint(float v);
5608
5609extern float2 __attribute__((const, overloadable))
5610 rint(float2 v);
5611
5612extern float3 __attribute__((const, overloadable))
5613 rint(float3 v);
5614
5615extern float4 __attribute__((const, overloadable))
5616 rint(float4 v);
5617
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005618#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5619extern half __attribute__((const, overloadable))
5620 rint(half v);
5621#endif
5622
5623#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5624extern half2 __attribute__((const, overloadable))
5625 rint(half2 v);
5626#endif
5627
5628#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5629extern half3 __attribute__((const, overloadable))
5630 rint(half3 v);
5631#endif
5632
5633#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5634extern half4 __attribute__((const, overloadable))
5635 rint(half4 v);
5636#endif
5637
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005638/*
5639 * rootn: Nth root
5640 *
5641 * Compute the Nth root of a value.
5642 *
5643 * See also native_rootn().
5644 */
5645extern float __attribute__((const, overloadable))
5646 rootn(float v, int n);
5647
5648extern float2 __attribute__((const, overloadable))
5649 rootn(float2 v, int2 n);
5650
5651extern float3 __attribute__((const, overloadable))
5652 rootn(float3 v, int3 n);
5653
5654extern float4 __attribute__((const, overloadable))
5655 rootn(float4 v, int4 n);
5656
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005657#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5658extern half __attribute__((const, overloadable))
5659 rootn(half v, int n);
5660#endif
5661
5662#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5663extern half2 __attribute__((const, overloadable))
5664 rootn(half2 v, int2 n);
5665#endif
5666
5667#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5668extern half3 __attribute__((const, overloadable))
5669 rootn(half3 v, int3 n);
5670#endif
5671
5672#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5673extern half4 __attribute__((const, overloadable))
5674 rootn(half4 v, int4 n);
5675#endif
5676
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005677/*
5678 * round: Round away from zero
5679 *
5680 * Round to the nearest integral value.
5681 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005682 * round() rounds half values away from zero. For example, round(0.5f) returns 1.f
5683 * and round(1.5f) returns 2.f. Similarly, round(-0.5f) returns -1.f
5684 * and round(-1.5f) returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005685 *
5686 * rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction.
5687 */
5688extern float __attribute__((const, overloadable))
5689 round(float v);
5690
5691extern float2 __attribute__((const, overloadable))
5692 round(float2 v);
5693
5694extern float3 __attribute__((const, overloadable))
5695 round(float3 v);
5696
5697extern float4 __attribute__((const, overloadable))
5698 round(float4 v);
5699
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005700#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5701extern half __attribute__((const, overloadable))
5702 round(half v);
5703#endif
5704
5705#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5706extern half2 __attribute__((const, overloadable))
5707 round(half2 v);
5708#endif
5709
5710#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5711extern half3 __attribute__((const, overloadable))
5712 round(half3 v);
5713#endif
5714
5715#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5716extern half4 __attribute__((const, overloadable))
5717 round(half4 v);
5718#endif
5719
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005720/*
5721 * rsqrt: Reciprocal of a square root
5722 *
5723 * Returns (1 / sqrt(v)).
5724 *
5725 * See also half_rsqrt(), native_rsqrt().
5726 */
5727extern float __attribute__((const, overloadable))
5728 rsqrt(float v);
5729
5730extern float2 __attribute__((const, overloadable))
5731 rsqrt(float2 v);
5732
5733extern float3 __attribute__((const, overloadable))
5734 rsqrt(float3 v);
5735
5736extern float4 __attribute__((const, overloadable))
5737 rsqrt(float4 v);
5738
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005739#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5740extern half __attribute__((const, overloadable))
5741 rsqrt(half v);
5742#endif
5743
5744#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5745extern half2 __attribute__((const, overloadable))
5746 rsqrt(half2 v);
5747#endif
5748
5749#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5750extern half3 __attribute__((const, overloadable))
5751 rsqrt(half3 v);
5752#endif
5753
5754#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5755extern half4 __attribute__((const, overloadable))
5756 rsqrt(half4 v);
5757#endif
5758
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005759/*
5760 * sign: Sign of a value
5761 *
5762 * Returns the sign of a value.
5763 *
5764 * if (v < 0) return -1.f;
5765 * else if (v > 0) return 1.f;
5766 * else return 0.f;
5767 */
5768extern float __attribute__((const, overloadable))
5769 sign(float v);
5770
5771extern float2 __attribute__((const, overloadable))
5772 sign(float2 v);
5773
5774extern float3 __attribute__((const, overloadable))
5775 sign(float3 v);
5776
5777extern float4 __attribute__((const, overloadable))
5778 sign(float4 v);
5779
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005780#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5781extern half __attribute__((const, overloadable))
5782 sign(half v);
5783#endif
5784
5785#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5786extern half2 __attribute__((const, overloadable))
5787 sign(half2 v);
5788#endif
5789
5790#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5791extern half3 __attribute__((const, overloadable))
5792 sign(half3 v);
5793#endif
5794
5795#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5796extern half4 __attribute__((const, overloadable))
5797 sign(half4 v);
5798#endif
5799
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005800/*
5801 * sin: Sine
5802 *
5803 * Returns the sine of an angle measured in radians.
5804 *
5805 * See also native_sin().
5806 */
5807extern float __attribute__((const, overloadable))
5808 sin(float v);
5809
5810extern float2 __attribute__((const, overloadable))
5811 sin(float2 v);
5812
5813extern float3 __attribute__((const, overloadable))
5814 sin(float3 v);
5815
5816extern float4 __attribute__((const, overloadable))
5817 sin(float4 v);
5818
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005819#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5820extern half __attribute__((const, overloadable))
5821 sin(half v);
5822#endif
5823
5824#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5825extern half2 __attribute__((const, overloadable))
5826 sin(half2 v);
5827#endif
5828
5829#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5830extern half3 __attribute__((const, overloadable))
5831 sin(half3 v);
5832#endif
5833
5834#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5835extern half4 __attribute__((const, overloadable))
5836 sin(half4 v);
5837#endif
5838
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005839/*
5840 * sincos: Sine and cosine
5841 *
5842 * Returns the sine and cosine of a value.
5843 *
5844 * See also native_sincos().
5845 *
5846 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005847 * v: Incoming value in radians.
Jean-Luc Brouillet4a730042015-04-02 16:15:25 -07005848 * cos: *cos will be set to the cosine value.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005849 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07005850 * Returns: Sine of v.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005851 */
5852extern float __attribute__((overloadable))
5853 sincos(float v, float* cos);
5854
5855extern float2 __attribute__((overloadable))
5856 sincos(float2 v, float2* cos);
5857
5858extern float3 __attribute__((overloadable))
5859 sincos(float3 v, float3* cos);
5860
5861extern float4 __attribute__((overloadable))
5862 sincos(float4 v, float4* cos);
5863
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005864#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5865extern half __attribute__((overloadable))
5866 sincos(half v, half* cos);
5867#endif
5868
5869#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5870extern half2 __attribute__((overloadable))
5871 sincos(half2 v, half2* cos);
5872#endif
5873
5874#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5875extern half3 __attribute__((overloadable))
5876 sincos(half3 v, half3* cos);
5877#endif
5878
5879#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5880extern half4 __attribute__((overloadable))
5881 sincos(half4 v, half4* cos);
5882#endif
5883
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005884/*
5885 * sinh: Hyperbolic sine
5886 *
5887 * Returns the hyperbolic sine of v, where v is measured in radians.
5888 *
5889 * See also native_sinh().
5890 */
5891extern float __attribute__((const, overloadable))
5892 sinh(float v);
5893
5894extern float2 __attribute__((const, overloadable))
5895 sinh(float2 v);
5896
5897extern float3 __attribute__((const, overloadable))
5898 sinh(float3 v);
5899
5900extern float4 __attribute__((const, overloadable))
5901 sinh(float4 v);
5902
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005903#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5904extern half __attribute__((const, overloadable))
5905 sinh(half v);
5906#endif
5907
5908#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5909extern half2 __attribute__((const, overloadable))
5910 sinh(half2 v);
5911#endif
5912
5913#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5914extern half3 __attribute__((const, overloadable))
5915 sinh(half3 v);
5916#endif
5917
5918#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5919extern half4 __attribute__((const, overloadable))
5920 sinh(half4 v);
5921#endif
5922
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005923/*
5924 * sinpi: Sine of a number multiplied by pi
5925 *
5926 * Returns the sine of (v * pi), where (v * pi) is measured in radians.
5927 *
5928 * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
5929 *
5930 * See also native_sinpi().
5931 */
5932extern float __attribute__((const, overloadable))
5933 sinpi(float v);
5934
5935extern float2 __attribute__((const, overloadable))
5936 sinpi(float2 v);
5937
5938extern float3 __attribute__((const, overloadable))
5939 sinpi(float3 v);
5940
5941extern float4 __attribute__((const, overloadable))
5942 sinpi(float4 v);
5943
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005944#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5945extern half __attribute__((const, overloadable))
5946 sinpi(half v);
5947#endif
5948
5949#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5950extern half2 __attribute__((const, overloadable))
5951 sinpi(half2 v);
5952#endif
5953
5954#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5955extern half3 __attribute__((const, overloadable))
5956 sinpi(half3 v);
5957#endif
5958
5959#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5960extern half4 __attribute__((const, overloadable))
5961 sinpi(half4 v);
5962#endif
5963
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07005964/*
5965 * sqrt: Square root
5966 *
5967 * Returns the square root of a value.
5968 *
5969 * See also half_sqrt(), native_sqrt().
5970 */
5971extern float __attribute__((const, overloadable))
5972 sqrt(float v);
5973
5974extern float2 __attribute__((const, overloadable))
5975 sqrt(float2 v);
5976
5977extern float3 __attribute__((const, overloadable))
5978 sqrt(float3 v);
5979
5980extern float4 __attribute__((const, overloadable))
5981 sqrt(float4 v);
5982
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08005983#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5984extern half __attribute__((const, overloadable))
5985 sqrt(half v);
5986#endif
5987
5988#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5989extern half2 __attribute__((const, overloadable))
5990 sqrt(half2 v);
5991#endif
5992
5993#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5994extern half3 __attribute__((const, overloadable))
5995 sqrt(half3 v);
5996#endif
5997
5998#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
5999extern half4 __attribute__((const, overloadable))
6000 sqrt(half4 v);
6001#endif
6002
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006003/*
6004 * step: 0 if less than a value, 0 otherwise
6005 *
6006 * Returns 0.f if v < edge, 1.f otherwise.
6007 *
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07006008 * This can be useful to create conditional computations without using loops and branching
6009 * instructions. For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i])
6010 * 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 -07006011 */
6012extern float __attribute__((const, overloadable))
6013 step(float edge, float v);
6014
6015extern float2 __attribute__((const, overloadable))
6016 step(float2 edge, float2 v);
6017
6018extern float3 __attribute__((const, overloadable))
6019 step(float3 edge, float3 v);
6020
6021extern float4 __attribute__((const, overloadable))
6022 step(float4 edge, float4 v);
6023
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006024#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6025extern half __attribute__((const, overloadable))
6026 step(half edge, half v);
6027#endif
6028
6029#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6030extern half2 __attribute__((const, overloadable))
6031 step(half2 edge, half2 v);
6032#endif
6033
6034#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6035extern half3 __attribute__((const, overloadable))
6036 step(half3 edge, half3 v);
6037#endif
6038
6039#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6040extern half4 __attribute__((const, overloadable))
6041 step(half4 edge, half4 v);
6042#endif
6043
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006044extern float2 __attribute__((const, overloadable))
6045 step(float2 edge, float v);
6046
6047extern float3 __attribute__((const, overloadable))
6048 step(float3 edge, float v);
6049
6050extern float4 __attribute__((const, overloadable))
6051 step(float4 edge, float v);
6052
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006053#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6054extern half2 __attribute__((const, overloadable))
6055 step(half2 edge, half v);
6056#endif
6057
6058#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6059extern half3 __attribute__((const, overloadable))
6060 step(half3 edge, half v);
6061#endif
6062
6063#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6064extern half4 __attribute__((const, overloadable))
6065 step(half4 edge, half v);
6066#endif
6067
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006068#if (defined(RS_VERSION) && (RS_VERSION >= 21))
6069extern float2 __attribute__((const, overloadable))
6070 step(float edge, float2 v);
6071#endif
6072
6073#if (defined(RS_VERSION) && (RS_VERSION >= 21))
6074extern float3 __attribute__((const, overloadable))
6075 step(float edge, float3 v);
6076#endif
6077
6078#if (defined(RS_VERSION) && (RS_VERSION >= 21))
6079extern float4 __attribute__((const, overloadable))
6080 step(float edge, float4 v);
6081#endif
6082
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006083#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6084extern half2 __attribute__((const, overloadable))
6085 step(half edge, half2 v);
6086#endif
6087
6088#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6089extern half3 __attribute__((const, overloadable))
6090 step(half edge, half3 v);
6091#endif
6092
6093#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6094extern half4 __attribute__((const, overloadable))
6095 step(half edge, half4 v);
6096#endif
6097
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006098/*
6099 * tan: Tangent
6100 *
6101 * Returns the tangent of an angle measured in radians.
6102 *
6103 * See also native_tan().
6104 */
6105extern float __attribute__((const, overloadable))
6106 tan(float v);
6107
6108extern float2 __attribute__((const, overloadable))
6109 tan(float2 v);
6110
6111extern float3 __attribute__((const, overloadable))
6112 tan(float3 v);
6113
6114extern float4 __attribute__((const, overloadable))
6115 tan(float4 v);
6116
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006117#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6118extern half __attribute__((const, overloadable))
6119 tan(half v);
6120#endif
6121
6122#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6123extern half2 __attribute__((const, overloadable))
6124 tan(half2 v);
6125#endif
6126
6127#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6128extern half3 __attribute__((const, overloadable))
6129 tan(half3 v);
6130#endif
6131
6132#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6133extern half4 __attribute__((const, overloadable))
6134 tan(half4 v);
6135#endif
6136
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006137/*
6138 * tanh: Hyperbolic tangent
6139 *
6140 * Returns the hyperbolic tangent of a value.
6141 *
6142 * See also native_tanh().
6143 */
6144extern float __attribute__((const, overloadable))
6145 tanh(float v);
6146
6147extern float2 __attribute__((const, overloadable))
6148 tanh(float2 v);
6149
6150extern float3 __attribute__((const, overloadable))
6151 tanh(float3 v);
6152
6153extern float4 __attribute__((const, overloadable))
6154 tanh(float4 v);
6155
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006156#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6157extern half __attribute__((const, overloadable))
6158 tanh(half v);
6159#endif
6160
6161#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6162extern half2 __attribute__((const, overloadable))
6163 tanh(half2 v);
6164#endif
6165
6166#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6167extern half3 __attribute__((const, overloadable))
6168 tanh(half3 v);
6169#endif
6170
6171#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6172extern half4 __attribute__((const, overloadable))
6173 tanh(half4 v);
6174#endif
6175
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006176/*
6177 * tanpi: Tangent of a number multiplied by pi
6178 *
6179 * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
6180 *
6181 * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
6182 *
6183 * See also native_tanpi().
6184 */
6185extern float __attribute__((const, overloadable))
6186 tanpi(float v);
6187
6188extern float2 __attribute__((const, overloadable))
6189 tanpi(float2 v);
6190
6191extern float3 __attribute__((const, overloadable))
6192 tanpi(float3 v);
6193
6194extern float4 __attribute__((const, overloadable))
6195 tanpi(float4 v);
6196
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006197#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6198extern half __attribute__((const, overloadable))
6199 tanpi(half v);
6200#endif
6201
6202#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6203extern half2 __attribute__((const, overloadable))
6204 tanpi(half2 v);
6205#endif
6206
6207#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6208extern half3 __attribute__((const, overloadable))
6209 tanpi(half3 v);
6210#endif
6211
6212#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6213extern half4 __attribute__((const, overloadable))
6214 tanpi(half4 v);
6215#endif
6216
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006217/*
6218 * tgamma: Gamma function
6219 *
6220 * Returns the gamma function of a value.
6221 *
6222 * See also lgamma().
6223 */
6224extern float __attribute__((const, overloadable))
6225 tgamma(float v);
6226
6227extern float2 __attribute__((const, overloadable))
6228 tgamma(float2 v);
6229
6230extern float3 __attribute__((const, overloadable))
6231 tgamma(float3 v);
6232
6233extern float4 __attribute__((const, overloadable))
6234 tgamma(float4 v);
6235
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006236#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6237extern half __attribute__((const, overloadable))
6238 tgamma(half v);
6239#endif
6240
6241#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6242extern half2 __attribute__((const, overloadable))
6243 tgamma(half2 v);
6244#endif
6245
6246#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6247extern half3 __attribute__((const, overloadable))
6248 tgamma(half3 v);
6249#endif
6250
6251#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6252extern half4 __attribute__((const, overloadable))
6253 tgamma(half4 v);
6254#endif
6255
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006256/*
6257 * trunc: Truncates a floating point
6258 *
6259 * Rounds to integral using truncation.
6260 *
6261 * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
6262 *
6263 * See rint() and round() for other rounding options.
6264 */
6265extern float __attribute__((const, overloadable))
6266 trunc(float v);
6267
6268extern float2 __attribute__((const, overloadable))
6269 trunc(float2 v);
6270
6271extern float3 __attribute__((const, overloadable))
6272 trunc(float3 v);
6273
6274extern float4 __attribute__((const, overloadable))
6275 trunc(float4 v);
6276
Pirama Arumuga Nainar586539c2015-12-09 15:56:03 -08006277#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6278extern half __attribute__((const, overloadable))
6279 trunc(half v);
6280#endif
6281
6282#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6283extern half2 __attribute__((const, overloadable))
6284 trunc(half2 v);
6285#endif
6286
6287#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6288extern half3 __attribute__((const, overloadable))
6289 trunc(half3 v);
6290#endif
6291
6292#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
6293extern half4 __attribute__((const, overloadable))
6294 trunc(half4 v);
6295#endif
6296
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07006297/*
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006298 * rsClamp: Restrain a value to a range
Jason Sams9df3b2b2011-08-08 14:31:25 -07006299 *
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006300 * DEPRECATED. Do not use.
Jason Sams044e2ee2011-08-08 16:52:30 -07006301 *
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006302 * Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006303 *
6304 * Parameters:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07006305 * amount: Value to clamp.
6306 * low: Lower bound.
6307 * high: Upper bound.
Jason Sams9df3b2b2011-08-08 14:31:25 -07006308 */
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006309extern char __attribute__((const, always_inline, overloadable
6310#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6311, deprecated("Use clamp() instead.")
6312#endif
6313))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006314 rsClamp(char amount, char low, char high);
Jason Sams044e2ee2011-08-08 16:52:30 -07006315
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006316extern uchar __attribute__((const, always_inline, overloadable
6317#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6318, deprecated("Use clamp() instead.")
6319#endif
6320))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006321 rsClamp(uchar amount, uchar low, uchar high);
Jason Samsc61346b2010-05-28 18:23:22 -07006322
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006323extern short __attribute__((const, always_inline, overloadable
6324#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6325, deprecated("Use clamp() instead.")
6326#endif
6327))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006328 rsClamp(short amount, short low, short high);
Jason Samse1eb6152011-06-21 16:42:30 -07006329
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006330extern ushort __attribute__((const, always_inline, overloadable
6331#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6332, deprecated("Use clamp() instead.")
6333#endif
6334))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006335 rsClamp(ushort amount, ushort low, ushort high);
6336
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006337extern int __attribute__((const, always_inline, overloadable
6338#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6339, deprecated("Use clamp() instead.")
6340#endif
6341))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006342 rsClamp(int amount, int low, int high);
6343
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006344extern uint __attribute__((const, always_inline, overloadable
6345#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6346, deprecated("Use clamp() instead.")
6347#endif
6348))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006349 rsClamp(uint amount, uint low, uint high);
6350
6351/*
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006352 * rsFrac: Returns the fractional part of a float
6353 *
6354 * DEPRECATED. Do not use.
6355 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006356 * Returns the fractional part of a float
Jason Samse1eb6152011-06-21 16:42:30 -07006357 */
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07006358extern float __attribute__((const, overloadable
6359#if (defined(RS_VERSION) && (RS_VERSION >= 22))
6360, deprecated("Use fract() instead.")
6361#endif
6362))
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006363 rsFrac(float v);
Jason Sams044e2ee2011-08-08 16:52:30 -07006364
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006365/*
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07006366 * rsRand: Pseudo-random number
6367 *
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006368 * Return a random value between 0 (or min_value) and max_malue.
Jason Samse1eb6152011-06-21 16:42:30 -07006369 */
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006370extern int __attribute__((overloadable))
6371 rsRand(int max_value);
Jason Samse1eb6152011-06-21 16:42:30 -07006372
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006373extern int __attribute__((overloadable))
6374 rsRand(int min_value, int max_value);
Jason Samse1eb6152011-06-21 16:42:30 -07006375
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006376extern float __attribute__((overloadable))
6377 rsRand(float max_value);
Jason Samse1eb6152011-06-21 16:42:30 -07006378
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006379extern float __attribute__((overloadable))
6380 rsRand(float min_value, float max_value);
6381
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07006382#endif // RENDERSCRIPT_RS_MATH_RSH