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