2 * Copyright (C) 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
20 * rs_math.rsh: Mathematical Constants and Functions
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.
27 * // The following call sets
29 * // a.y to sin(b.y), and
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.
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
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.
53 #ifndef RENDERSCRIPT_RS_MATH_RSH
54 #define RENDERSCRIPT_RS_MATH_RSH
57 * M_1_PI: 1 / pi, as a 32 bit float
59 * The inverse of pi, as a 32 bit float.
61 static const float M_1_PI = 0.318309886183790671537767526745028724f;
64 * M_2_PI: 2 / pi, as a 32 bit float
66 * 2 divided by pi, as a 32 bit float.
68 static const float M_2_PI = 0.636619772367581343075535053490057448f;
71 * M_2_PIl: 2 / pi, as a 32 bit float
73 * DEPRECATED. Do not use.
75 * 2 divided by pi, as a 32 bit float.
77 static const float M_2_PIl = 0.636619772367581343075535053490057448f;
80 * M_2_SQRTPI: 2 / sqrt(pi), as a 32 bit float
82 * 2 divided by the square root of pi, as a 32 bit float.
84 static const float M_2_SQRTPI = 1.128379167095512573896158903121545172f;
87 * M_E: e, as a 32 bit float
89 * The number e, the base of the natural logarithm, as a 32 bit float.
91 static const float M_E = 2.718281828459045235360287471352662498f;
94 * M_LN10: log_e(10), as a 32 bit float
96 * The natural logarithm of 10, as a 32 bit float.
98 static const float M_LN10 = 2.302585092994045684017991454684364208f;
101 * M_LN2: log_e(2), as a 32 bit float
103 * The natural logarithm of 2, as a 32 bit float.
105 static const float M_LN2 = 0.693147180559945309417232121458176568f;
108 * M_LOG10E: log_10(e), as a 32 bit float
110 * The logarithm base 10 of e, as a 32 bit float.
112 static const float M_LOG10E = 0.434294481903251827651128918916605082f;
115 * M_LOG2E: log_2(e), as a 32 bit float
117 * The logarithm base 2 of e, as a 32 bit float.
119 static const float M_LOG2E = 1.442695040888963407359924681001892137f;
122 * M_PI: pi, as a 32 bit float
124 * The constant pi, as a 32 bit float.
126 static const float M_PI = 3.141592653589793238462643383279502884f;
129 * M_PI_2: pi / 2, as a 32 bit float
131 * Pi divided by 2, as a 32 bit float.
133 static const float M_PI_2 = 1.570796326794896619231321691639751442f;
136 * M_PI_4: pi / 4, as a 32 bit float
138 * Pi divided by 4, as a 32 bit float.
140 static const float M_PI_4 = 0.785398163397448309615660845819875721f;
143 * M_SQRT1_2: 1 / sqrt(2), as a 32 bit float
145 * The inverse of the square root of 2, as a 32 bit float.
147 static const float M_SQRT1_2 = 0.707106781186547524400844362104849039f;
150 * M_SQRT2: sqrt(2), as a 32 bit float
152 * The square root of 2, as a 32 bit float.
154 static const float M_SQRT2 = 1.414213562373095048801688724209698079f;
157 * abs: Absolute value of an integer
159 * Returns the absolute value of an integer.
161 * For floats, use fabs().
163 extern uchar __attribute__((const, overloadable))
166 extern uchar2 __attribute__((const, overloadable))
169 extern uchar3 __attribute__((const, overloadable))
172 extern uchar4 __attribute__((const, overloadable))
175 extern ushort __attribute__((const, overloadable))
178 extern ushort2 __attribute__((const, overloadable))
181 extern ushort3 __attribute__((const, overloadable))
184 extern ushort4 __attribute__((const, overloadable))
187 extern uint __attribute__((const, overloadable))
190 extern uint2 __attribute__((const, overloadable))
193 extern uint3 __attribute__((const, overloadable))
196 extern uint4 __attribute__((const, overloadable))
200 * acos: Inverse cosine
202 * Returns the inverse cosine, in radians.
204 * See also native_acos().
206 extern float __attribute__((const, overloadable))
209 extern float2 __attribute__((const, overloadable))
212 extern float3 __attribute__((const, overloadable))
215 extern float4 __attribute__((const, overloadable))
218 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
219 extern half __attribute__((const, overloadable))
223 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
224 extern half2 __attribute__((const, overloadable))
228 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
229 extern half3 __attribute__((const, overloadable))
233 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
234 extern half4 __attribute__((const, overloadable))
239 * acosh: Inverse hyperbolic cosine
241 * Returns the inverse hyperbolic cosine, in radians.
243 * See also native_acosh().
245 extern float __attribute__((const, overloadable))
248 extern float2 __attribute__((const, overloadable))
251 extern float3 __attribute__((const, overloadable))
254 extern float4 __attribute__((const, overloadable))
257 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
258 extern half __attribute__((const, overloadable))
262 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
263 extern half2 __attribute__((const, overloadable))
267 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
268 extern half3 __attribute__((const, overloadable))
272 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
273 extern half4 __attribute__((const, overloadable))
278 * acospi: Inverse cosine divided by pi
280 * Returns the inverse cosine in radians, divided by pi.
282 * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
284 * See also native_acospi().
286 extern float __attribute__((const, overloadable))
289 extern float2 __attribute__((const, overloadable))
292 extern float3 __attribute__((const, overloadable))
295 extern float4 __attribute__((const, overloadable))
298 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
299 extern half __attribute__((const, overloadable))
303 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
304 extern half2 __attribute__((const, overloadable))
308 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
309 extern half3 __attribute__((const, overloadable))
313 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
314 extern half4 __attribute__((const, overloadable))
321 * Returns the inverse sine, in radians.
323 * See also native_asin().
325 extern float __attribute__((const, overloadable))
328 extern float2 __attribute__((const, overloadable))
331 extern float3 __attribute__((const, overloadable))
334 extern float4 __attribute__((const, overloadable))
337 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
338 extern half __attribute__((const, overloadable))
342 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
343 extern half2 __attribute__((const, overloadable))
347 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
348 extern half3 __attribute__((const, overloadable))
352 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
353 extern half4 __attribute__((const, overloadable))
358 * asinh: Inverse hyperbolic sine
360 * Returns the inverse hyperbolic sine, in radians.
362 * See also native_asinh().
364 extern float __attribute__((const, overloadable))
367 extern float2 __attribute__((const, overloadable))
370 extern float3 __attribute__((const, overloadable))
373 extern float4 __attribute__((const, overloadable))
376 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
377 extern half __attribute__((const, overloadable))
381 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
382 extern half2 __attribute__((const, overloadable))
386 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
387 extern half3 __attribute__((const, overloadable))
391 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
392 extern half4 __attribute__((const, overloadable))
397 * asinpi: Inverse sine divided by pi
399 * Returns the inverse sine in radians, divided by pi.
401 * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
403 * See also native_asinpi().
405 extern float __attribute__((const, overloadable))
408 extern float2 __attribute__((const, overloadable))
411 extern float3 __attribute__((const, overloadable))
414 extern float4 __attribute__((const, overloadable))
417 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
418 extern half __attribute__((const, overloadable))
422 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
423 extern half2 __attribute__((const, overloadable))
427 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
428 extern half3 __attribute__((const, overloadable))
432 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
433 extern half4 __attribute__((const, overloadable))
438 * atan: Inverse tangent
440 * Returns the inverse tangent, in radians.
442 * See also native_atan().
444 extern float __attribute__((const, overloadable))
447 extern float2 __attribute__((const, overloadable))
450 extern float3 __attribute__((const, overloadable))
453 extern float4 __attribute__((const, overloadable))
456 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
457 extern half __attribute__((const, overloadable))
461 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
462 extern half2 __attribute__((const, overloadable))
466 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
467 extern half3 __attribute__((const, overloadable))
471 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
472 extern half4 __attribute__((const, overloadable))
477 * atan2: Inverse tangent of a ratio
479 * Returns the inverse tangent of (numerator / denominator), in radians.
481 * See also native_atan2().
484 * numerator: Numerator.
485 * denominator: Denominator. Can be 0.
487 extern float __attribute__((const, overloadable))
488 atan2(float numerator, float denominator);
490 extern float2 __attribute__((const, overloadable))
491 atan2(float2 numerator, float2 denominator);
493 extern float3 __attribute__((const, overloadable))
494 atan2(float3 numerator, float3 denominator);
496 extern float4 __attribute__((const, overloadable))
497 atan2(float4 numerator, float4 denominator);
499 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
500 extern half __attribute__((const, overloadable))
501 atan2(half numerator, half denominator);
504 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
505 extern half2 __attribute__((const, overloadable))
506 atan2(half2 numerator, half2 denominator);
509 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
510 extern half3 __attribute__((const, overloadable))
511 atan2(half3 numerator, half3 denominator);
514 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
515 extern half4 __attribute__((const, overloadable))
516 atan2(half4 numerator, half4 denominator);
520 * atan2pi: Inverse tangent of a ratio, divided by pi
522 * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
524 * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
526 * See also native_atan2pi().
529 * numerator: Numerator.
530 * denominator: Denominator. Can be 0.
532 extern float __attribute__((const, overloadable))
533 atan2pi(float numerator, float denominator);
535 extern float2 __attribute__((const, overloadable))
536 atan2pi(float2 numerator, float2 denominator);
538 extern float3 __attribute__((const, overloadable))
539 atan2pi(float3 numerator, float3 denominator);
541 extern float4 __attribute__((const, overloadable))
542 atan2pi(float4 numerator, float4 denominator);
544 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
545 extern half __attribute__((const, overloadable))
546 atan2pi(half numerator, half denominator);
549 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
550 extern half2 __attribute__((const, overloadable))
551 atan2pi(half2 numerator, half2 denominator);
554 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
555 extern half3 __attribute__((const, overloadable))
556 atan2pi(half3 numerator, half3 denominator);
559 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
560 extern half4 __attribute__((const, overloadable))
561 atan2pi(half4 numerator, half4 denominator);
565 * atanh: Inverse hyperbolic tangent
567 * Returns the inverse hyperbolic tangent, in radians.
569 * See also native_atanh().
571 extern float __attribute__((const, overloadable))
574 extern float2 __attribute__((const, overloadable))
577 extern float3 __attribute__((const, overloadable))
580 extern float4 __attribute__((const, overloadable))
583 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
584 extern half __attribute__((const, overloadable))
588 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
589 extern half2 __attribute__((const, overloadable))
593 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
594 extern half3 __attribute__((const, overloadable))
598 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
599 extern half4 __attribute__((const, overloadable))
604 * atanpi: Inverse tangent divided by pi
606 * Returns the inverse tangent in radians, divided by pi.
608 * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
610 * See also native_atanpi().
612 extern float __attribute__((const, overloadable))
615 extern float2 __attribute__((const, overloadable))
618 extern float3 __attribute__((const, overloadable))
621 extern float4 __attribute__((const, overloadable))
624 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
625 extern half __attribute__((const, overloadable))
629 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
630 extern half2 __attribute__((const, overloadable))
634 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
635 extern half3 __attribute__((const, overloadable))
639 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
640 extern half4 __attribute__((const, overloadable))
647 * Returns the cube root.
649 * See also native_cbrt().
651 extern float __attribute__((const, overloadable))
654 extern float2 __attribute__((const, overloadable))
657 extern float3 __attribute__((const, overloadable))
660 extern float4 __attribute__((const, overloadable))
663 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
664 extern half __attribute__((const, overloadable))
668 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
669 extern half2 __attribute__((const, overloadable))
673 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
674 extern half3 __attribute__((const, overloadable))
678 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
679 extern half4 __attribute__((const, overloadable))
684 * ceil: Smallest integer not less than a value
686 * Returns the smallest integer not less than a value.
688 * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
692 extern float __attribute__((const, overloadable))
695 extern float2 __attribute__((const, overloadable))
698 extern float3 __attribute__((const, overloadable))
701 extern float4 __attribute__((const, overloadable))
704 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
705 extern half __attribute__((const, overloadable))
709 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
710 extern half2 __attribute__((const, overloadable))
714 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
715 extern half3 __attribute__((const, overloadable))
719 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
720 extern half4 __attribute__((const, overloadable))
725 * clamp: Restrain a value to a range
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.
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.
733 * If min_value is greater than max_value, the results are undefined.
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.
740 extern float __attribute__((const, overloadable))
741 clamp(float value, float min_value, float max_value);
743 extern float2 __attribute__((const, overloadable))
744 clamp(float2 value, float2 min_value, float2 max_value);
746 extern float3 __attribute__((const, overloadable))
747 clamp(float3 value, float3 min_value, float3 max_value);
749 extern float4 __attribute__((const, overloadable))
750 clamp(float4 value, float4 min_value, float4 max_value);
752 extern float2 __attribute__((const, overloadable))
753 clamp(float2 value, float min_value, float max_value);
755 extern float3 __attribute__((const, overloadable))
756 clamp(float3 value, float min_value, float max_value);
758 extern float4 __attribute__((const, overloadable))
759 clamp(float4 value, float min_value, float max_value);
761 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
762 extern char __attribute__((const, overloadable))
763 clamp(char value, char min_value, char max_value);
766 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
767 extern char2 __attribute__((const, overloadable))
768 clamp(char2 value, char2 min_value, char2 max_value);
771 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
772 extern char3 __attribute__((const, overloadable))
773 clamp(char3 value, char3 min_value, char3 max_value);
776 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
777 extern char4 __attribute__((const, overloadable))
778 clamp(char4 value, char4 min_value, char4 max_value);
781 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
782 extern uchar __attribute__((const, overloadable))
783 clamp(uchar value, uchar min_value, uchar max_value);
786 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
787 extern uchar2 __attribute__((const, overloadable))
788 clamp(uchar2 value, uchar2 min_value, uchar2 max_value);
791 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
792 extern uchar3 __attribute__((const, overloadable))
793 clamp(uchar3 value, uchar3 min_value, uchar3 max_value);
796 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
797 extern uchar4 __attribute__((const, overloadable))
798 clamp(uchar4 value, uchar4 min_value, uchar4 max_value);
801 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
802 extern short __attribute__((const, overloadable))
803 clamp(short value, short min_value, short max_value);
806 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
807 extern short2 __attribute__((const, overloadable))
808 clamp(short2 value, short2 min_value, short2 max_value);
811 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
812 extern short3 __attribute__((const, overloadable))
813 clamp(short3 value, short3 min_value, short3 max_value);
816 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
817 extern short4 __attribute__((const, overloadable))
818 clamp(short4 value, short4 min_value, short4 max_value);
821 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
822 extern ushort __attribute__((const, overloadable))
823 clamp(ushort value, ushort min_value, ushort max_value);
826 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
827 extern ushort2 __attribute__((const, overloadable))
828 clamp(ushort2 value, ushort2 min_value, ushort2 max_value);
831 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
832 extern ushort3 __attribute__((const, overloadable))
833 clamp(ushort3 value, ushort3 min_value, ushort3 max_value);
836 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
837 extern ushort4 __attribute__((const, overloadable))
838 clamp(ushort4 value, ushort4 min_value, ushort4 max_value);
841 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
842 extern int __attribute__((const, overloadable))
843 clamp(int value, int min_value, int max_value);
846 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
847 extern int2 __attribute__((const, overloadable))
848 clamp(int2 value, int2 min_value, int2 max_value);
851 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
852 extern int3 __attribute__((const, overloadable))
853 clamp(int3 value, int3 min_value, int3 max_value);
856 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
857 extern int4 __attribute__((const, overloadable))
858 clamp(int4 value, int4 min_value, int4 max_value);
861 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
862 extern uint __attribute__((const, overloadable))
863 clamp(uint value, uint min_value, uint max_value);
866 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
867 extern uint2 __attribute__((const, overloadable))
868 clamp(uint2 value, uint2 min_value, uint2 max_value);
871 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
872 extern uint3 __attribute__((const, overloadable))
873 clamp(uint3 value, uint3 min_value, uint3 max_value);
876 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
877 extern uint4 __attribute__((const, overloadable))
878 clamp(uint4 value, uint4 min_value, uint4 max_value);
881 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
882 extern long __attribute__((const, overloadable))
883 clamp(long value, long min_value, long max_value);
886 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
887 extern long2 __attribute__((const, overloadable))
888 clamp(long2 value, long2 min_value, long2 max_value);
891 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
892 extern long3 __attribute__((const, overloadable))
893 clamp(long3 value, long3 min_value, long3 max_value);
896 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
897 extern long4 __attribute__((const, overloadable))
898 clamp(long4 value, long4 min_value, long4 max_value);
901 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
902 extern ulong __attribute__((const, overloadable))
903 clamp(ulong value, ulong min_value, ulong max_value);
906 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
907 extern ulong2 __attribute__((const, overloadable))
908 clamp(ulong2 value, ulong2 min_value, ulong2 max_value);
911 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
912 extern ulong3 __attribute__((const, overloadable))
913 clamp(ulong3 value, ulong3 min_value, ulong3 max_value);
916 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
917 extern ulong4 __attribute__((const, overloadable))
918 clamp(ulong4 value, ulong4 min_value, ulong4 max_value);
921 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
922 extern char2 __attribute__((const, overloadable))
923 clamp(char2 value, char min_value, char max_value);
926 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
927 extern char3 __attribute__((const, overloadable))
928 clamp(char3 value, char min_value, char max_value);
931 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
932 extern char4 __attribute__((const, overloadable))
933 clamp(char4 value, char min_value, char max_value);
936 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
937 extern uchar2 __attribute__((const, overloadable))
938 clamp(uchar2 value, uchar min_value, uchar max_value);
941 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
942 extern uchar3 __attribute__((const, overloadable))
943 clamp(uchar3 value, uchar min_value, uchar max_value);
946 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
947 extern uchar4 __attribute__((const, overloadable))
948 clamp(uchar4 value, uchar min_value, uchar max_value);
951 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
952 extern short2 __attribute__((const, overloadable))
953 clamp(short2 value, short min_value, short max_value);
956 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
957 extern short3 __attribute__((const, overloadable))
958 clamp(short3 value, short min_value, short max_value);
961 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
962 extern short4 __attribute__((const, overloadable))
963 clamp(short4 value, short min_value, short max_value);
966 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
967 extern ushort2 __attribute__((const, overloadable))
968 clamp(ushort2 value, ushort min_value, ushort max_value);
971 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
972 extern ushort3 __attribute__((const, overloadable))
973 clamp(ushort3 value, ushort min_value, ushort max_value);
976 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
977 extern ushort4 __attribute__((const, overloadable))
978 clamp(ushort4 value, ushort min_value, ushort max_value);
981 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
982 extern int2 __attribute__((const, overloadable))
983 clamp(int2 value, int min_value, int max_value);
986 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
987 extern int3 __attribute__((const, overloadable))
988 clamp(int3 value, int min_value, int max_value);
991 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
992 extern int4 __attribute__((const, overloadable))
993 clamp(int4 value, int min_value, int max_value);
996 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
997 extern uint2 __attribute__((const, overloadable))
998 clamp(uint2 value, uint min_value, uint max_value);
1001 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1002 extern uint3 __attribute__((const, overloadable))
1003 clamp(uint3 value, uint min_value, uint max_value);
1006 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1007 extern uint4 __attribute__((const, overloadable))
1008 clamp(uint4 value, uint min_value, uint max_value);
1011 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1012 extern long2 __attribute__((const, overloadable))
1013 clamp(long2 value, long min_value, long max_value);
1016 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1017 extern long3 __attribute__((const, overloadable))
1018 clamp(long3 value, long min_value, long max_value);
1021 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1022 extern long4 __attribute__((const, overloadable))
1023 clamp(long4 value, long min_value, long max_value);
1026 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1027 extern ulong2 __attribute__((const, overloadable))
1028 clamp(ulong2 value, ulong min_value, ulong max_value);
1031 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1032 extern ulong3 __attribute__((const, overloadable))
1033 clamp(ulong3 value, ulong min_value, ulong max_value);
1036 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
1037 extern ulong4 __attribute__((const, overloadable))
1038 clamp(ulong4 value, ulong min_value, ulong max_value);
1041 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1042 extern half __attribute__((const, overloadable))
1043 clamp(half value, half min_value, half max_value);
1046 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1047 extern half2 __attribute__((const, overloadable))
1048 clamp(half2 value, half2 min_value, half2 max_value);
1051 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1052 extern half3 __attribute__((const, overloadable))
1053 clamp(half3 value, half3 min_value, half3 max_value);
1056 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1057 extern half4 __attribute__((const, overloadable))
1058 clamp(half4 value, half4 min_value, half4 max_value);
1061 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1062 extern half2 __attribute__((const, overloadable))
1063 clamp(half2 value, half min_value, half max_value);
1066 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1067 extern half3 __attribute__((const, overloadable))
1068 clamp(half3 value, half min_value, half max_value);
1071 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1072 extern half4 __attribute__((const, overloadable))
1073 clamp(half4 value, half min_value, half max_value);
1077 * clz: Number of leading 0 bits
1079 * Returns the number of leading 0-bits in a value.
1081 * For example, clz((char)0x03) returns 6.
1083 extern char __attribute__((const, overloadable))
1086 extern char2 __attribute__((const, overloadable))
1089 extern char3 __attribute__((const, overloadable))
1092 extern char4 __attribute__((const, overloadable))
1095 extern uchar __attribute__((const, overloadable))
1098 extern uchar2 __attribute__((const, overloadable))
1101 extern uchar3 __attribute__((const, overloadable))
1104 extern uchar4 __attribute__((const, overloadable))
1107 extern short __attribute__((const, overloadable))
1110 extern short2 __attribute__((const, overloadable))
1113 extern short3 __attribute__((const, overloadable))
1116 extern short4 __attribute__((const, overloadable))
1119 extern ushort __attribute__((const, overloadable))
1122 extern ushort2 __attribute__((const, overloadable))
1125 extern ushort3 __attribute__((const, overloadable))
1128 extern ushort4 __attribute__((const, overloadable))
1131 extern int __attribute__((const, overloadable))
1134 extern int2 __attribute__((const, overloadable))
1137 extern int3 __attribute__((const, overloadable))
1140 extern int4 __attribute__((const, overloadable))
1143 extern uint __attribute__((const, overloadable))
1146 extern uint2 __attribute__((const, overloadable))
1149 extern uint3 __attribute__((const, overloadable))
1152 extern uint4 __attribute__((const, overloadable))
1156 * copysign: Copies the sign of a number to another
1158 * Copies the sign from sign_value to magnitude_value.
1160 * The value returned is either magnitude_value or -magnitude_value.
1162 * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
1164 extern float __attribute__((const, overloadable))
1165 copysign(float magnitude_value, float sign_value);
1167 extern float2 __attribute__((const, overloadable))
1168 copysign(float2 magnitude_value, float2 sign_value);
1170 extern float3 __attribute__((const, overloadable))
1171 copysign(float3 magnitude_value, float3 sign_value);
1173 extern float4 __attribute__((const, overloadable))
1174 copysign(float4 magnitude_value, float4 sign_value);
1176 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1177 extern half __attribute__((const, overloadable))
1178 copysign(half magnitude_value, half sign_value);
1181 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1182 extern half2 __attribute__((const, overloadable))
1183 copysign(half2 magnitude_value, half2 sign_value);
1186 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1187 extern half3 __attribute__((const, overloadable))
1188 copysign(half3 magnitude_value, half3 sign_value);
1191 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1192 extern half4 __attribute__((const, overloadable))
1193 copysign(half4 magnitude_value, half4 sign_value);
1199 * Returns the cosine of an angle measured in radians.
1201 * See also native_cos().
1203 extern float __attribute__((const, overloadable))
1206 extern float2 __attribute__((const, overloadable))
1209 extern float3 __attribute__((const, overloadable))
1212 extern float4 __attribute__((const, overloadable))
1215 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1216 extern half __attribute__((const, overloadable))
1220 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1221 extern half2 __attribute__((const, overloadable))
1225 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1226 extern half3 __attribute__((const, overloadable))
1230 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1231 extern half4 __attribute__((const, overloadable))
1236 * cosh: Hypebolic cosine
1238 * Returns the hypebolic cosine of v, where v is measured in radians.
1240 * See also native_cosh().
1242 extern float __attribute__((const, overloadable))
1245 extern float2 __attribute__((const, overloadable))
1248 extern float3 __attribute__((const, overloadable))
1251 extern float4 __attribute__((const, overloadable))
1254 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1255 extern half __attribute__((const, overloadable))
1259 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1260 extern half2 __attribute__((const, overloadable))
1264 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1265 extern half3 __attribute__((const, overloadable))
1269 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1270 extern half4 __attribute__((const, overloadable))
1275 * cospi: Cosine of a number multiplied by pi
1277 * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
1279 * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
1281 * See also native_cospi().
1283 extern float __attribute__((const, overloadable))
1286 extern float2 __attribute__((const, overloadable))
1289 extern float3 __attribute__((const, overloadable))
1292 extern float4 __attribute__((const, overloadable))
1295 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1296 extern half __attribute__((const, overloadable))
1300 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1301 extern half2 __attribute__((const, overloadable))
1305 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1306 extern half3 __attribute__((const, overloadable))
1310 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1311 extern half4 __attribute__((const, overloadable))
1316 * degrees: Converts radians into degrees
1318 * Converts from radians to degrees.
1320 extern float __attribute__((const, overloadable))
1323 extern float2 __attribute__((const, overloadable))
1326 extern float3 __attribute__((const, overloadable))
1329 extern float4 __attribute__((const, overloadable))
1332 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1333 extern half __attribute__((const, overloadable))
1337 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1338 extern half2 __attribute__((const, overloadable))
1342 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1343 extern half3 __attribute__((const, overloadable))
1347 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1348 extern half4 __attribute__((const, overloadable))
1353 * erf: Mathematical error function
1355 * Returns the error function.
1357 extern float __attribute__((const, overloadable))
1360 extern float2 __attribute__((const, overloadable))
1363 extern float3 __attribute__((const, overloadable))
1366 extern float4 __attribute__((const, overloadable))
1369 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1370 extern half __attribute__((const, overloadable))
1374 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1375 extern half2 __attribute__((const, overloadable))
1379 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1380 extern half3 __attribute__((const, overloadable))
1384 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1385 extern half4 __attribute__((const, overloadable))
1390 * erfc: Mathematical complementary error function
1392 * Returns the complementary error function.
1394 extern float __attribute__((const, overloadable))
1397 extern float2 __attribute__((const, overloadable))
1400 extern float3 __attribute__((const, overloadable))
1403 extern float4 __attribute__((const, overloadable))
1406 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1407 extern half __attribute__((const, overloadable))
1411 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1412 extern half2 __attribute__((const, overloadable))
1416 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1417 extern half3 __attribute__((const, overloadable))
1421 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1422 extern half4 __attribute__((const, overloadable))
1427 * exp: e raised to a number
1429 * Returns e raised to v, i.e. e ^ v.
1431 * See also native_exp().
1433 extern float __attribute__((const, overloadable))
1436 extern float2 __attribute__((const, overloadable))
1439 extern float3 __attribute__((const, overloadable))
1442 extern float4 __attribute__((const, overloadable))
1445 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1446 extern half __attribute__((const, overloadable))
1450 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1451 extern half2 __attribute__((const, overloadable))
1455 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1456 extern half3 __attribute__((const, overloadable))
1460 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1461 extern half4 __attribute__((const, overloadable))
1466 * exp10: 10 raised to a number
1468 * Returns 10 raised to v, i.e. 10.f ^ v.
1470 * See also native_exp10().
1472 extern float __attribute__((const, overloadable))
1475 extern float2 __attribute__((const, overloadable))
1478 extern float3 __attribute__((const, overloadable))
1481 extern float4 __attribute__((const, overloadable))
1484 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1485 extern half __attribute__((const, overloadable))
1489 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1490 extern half2 __attribute__((const, overloadable))
1494 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1495 extern half3 __attribute__((const, overloadable))
1499 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1500 extern half4 __attribute__((const, overloadable))
1505 * exp2: 2 raised to a number
1507 * Returns 2 raised to v, i.e. 2.f ^ v.
1509 * See also native_exp2().
1511 extern float __attribute__((const, overloadable))
1514 extern float2 __attribute__((const, overloadable))
1517 extern float3 __attribute__((const, overloadable))
1520 extern float4 __attribute__((const, overloadable))
1523 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1524 extern half __attribute__((const, overloadable))
1528 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1529 extern half2 __attribute__((const, overloadable))
1533 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1534 extern half3 __attribute__((const, overloadable))
1538 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1539 extern half4 __attribute__((const, overloadable))
1544 * expm1: e raised to a number minus one
1546 * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
1548 * See also native_expm1().
1550 extern float __attribute__((const, overloadable))
1553 extern float2 __attribute__((const, overloadable))
1556 extern float3 __attribute__((const, overloadable))
1559 extern float4 __attribute__((const, overloadable))
1562 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1563 extern half __attribute__((const, overloadable))
1567 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1568 extern half2 __attribute__((const, overloadable))
1572 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1573 extern half3 __attribute__((const, overloadable))
1577 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1578 extern half4 __attribute__((const, overloadable))
1583 * fabs: Absolute value of a float
1585 * Returns the absolute value of the float v.
1587 * For integers, use abs().
1589 extern float __attribute__((const, overloadable))
1592 extern float2 __attribute__((const, overloadable))
1595 extern float3 __attribute__((const, overloadable))
1598 extern float4 __attribute__((const, overloadable))
1601 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1602 extern half __attribute__((const, overloadable))
1606 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1607 extern half2 __attribute__((const, overloadable))
1611 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1612 extern half3 __attribute__((const, overloadable))
1616 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1617 extern half4 __attribute__((const, overloadable))
1622 * fdim: Positive difference between two values
1624 * Returns the positive difference between two values.
1626 * If a > b, returns (a - b) otherwise returns 0f.
1628 extern float __attribute__((const, overloadable))
1629 fdim(float a, float b);
1631 extern float2 __attribute__((const, overloadable))
1632 fdim(float2 a, float2 b);
1634 extern float3 __attribute__((const, overloadable))
1635 fdim(float3 a, float3 b);
1637 extern float4 __attribute__((const, overloadable))
1638 fdim(float4 a, float4 b);
1640 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1641 extern half __attribute__((const, overloadable))
1642 fdim(half a, half b);
1645 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1646 extern half2 __attribute__((const, overloadable))
1647 fdim(half2 a, half2 b);
1650 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1651 extern half3 __attribute__((const, overloadable))
1652 fdim(half3 a, half3 b);
1655 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1656 extern half4 __attribute__((const, overloadable))
1657 fdim(half4 a, half4 b);
1661 * floor: Smallest integer not greater than a value
1663 * Returns the smallest integer not greater than a value.
1665 * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f.
1669 extern float __attribute__((const, overloadable))
1672 extern float2 __attribute__((const, overloadable))
1675 extern float3 __attribute__((const, overloadable))
1678 extern float4 __attribute__((const, overloadable))
1681 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1682 extern half __attribute__((const, overloadable))
1686 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1687 extern half2 __attribute__((const, overloadable))
1691 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1692 extern half3 __attribute__((const, overloadable))
1696 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1697 extern half4 __attribute__((const, overloadable))
1702 * fma: Multiply and add
1704 * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
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.
1710 extern float __attribute__((const, overloadable))
1711 fma(float multiplicand1, float multiplicand2, float offset);
1713 extern float2 __attribute__((const, overloadable))
1714 fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
1716 extern float3 __attribute__((const, overloadable))
1717 fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
1719 extern float4 __attribute__((const, overloadable))
1720 fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
1722 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1723 extern half __attribute__((const, overloadable))
1724 fma(half multiplicand1, half multiplicand2, half offset);
1727 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1728 extern half2 __attribute__((const, overloadable))
1729 fma(half2 multiplicand1, half2 multiplicand2, half2 offset);
1732 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1733 extern half3 __attribute__((const, overloadable))
1734 fma(half3 multiplicand1, half3 multiplicand2, half3 offset);
1737 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1738 extern half4 __attribute__((const, overloadable))
1739 fma(half4 multiplicand1, half4 multiplicand2, half4 offset);
1743 * fmax: Maximum of two floats
1745 * Returns the maximum of a and b, i.e. (a < b ? b : a).
1747 * The max() function returns identical results but can be applied to more data types.
1749 extern float __attribute__((const, overloadable))
1750 fmax(float a, float b);
1752 extern float2 __attribute__((const, overloadable))
1753 fmax(float2 a, float2 b);
1755 extern float3 __attribute__((const, overloadable))
1756 fmax(float3 a, float3 b);
1758 extern float4 __attribute__((const, overloadable))
1759 fmax(float4 a, float4 b);
1761 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1762 extern half __attribute__((const, overloadable))
1763 fmax(half a, half b);
1766 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1767 extern half2 __attribute__((const, overloadable))
1768 fmax(half2 a, half2 b);
1771 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1772 extern half3 __attribute__((const, overloadable))
1773 fmax(half3 a, half3 b);
1776 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1777 extern half4 __attribute__((const, overloadable))
1778 fmax(half4 a, half4 b);
1781 extern float2 __attribute__((const, overloadable))
1782 fmax(float2 a, float b);
1784 extern float3 __attribute__((const, overloadable))
1785 fmax(float3 a, float b);
1787 extern float4 __attribute__((const, overloadable))
1788 fmax(float4 a, float b);
1790 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1791 extern half2 __attribute__((const, overloadable))
1792 fmax(half2 a, half b);
1795 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1796 extern half3 __attribute__((const, overloadable))
1797 fmax(half3 a, half b);
1800 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1801 extern half4 __attribute__((const, overloadable))
1802 fmax(half4 a, half b);
1806 * fmin: Minimum of two floats
1808 * Returns the minimum of a and b, i.e. (a > b ? b : a).
1810 * The min() function returns identical results but can be applied to more data types.
1812 extern float __attribute__((const, overloadable))
1813 fmin(float a, float b);
1815 extern float2 __attribute__((const, overloadable))
1816 fmin(float2 a, float2 b);
1818 extern float3 __attribute__((const, overloadable))
1819 fmin(float3 a, float3 b);
1821 extern float4 __attribute__((const, overloadable))
1822 fmin(float4 a, float4 b);
1824 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1825 extern half __attribute__((const, overloadable))
1826 fmin(half a, half b);
1829 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1830 extern half2 __attribute__((const, overloadable))
1831 fmin(half2 a, half2 b);
1834 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1835 extern half3 __attribute__((const, overloadable))
1836 fmin(half3 a, half3 b);
1839 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1840 extern half4 __attribute__((const, overloadable))
1841 fmin(half4 a, half4 b);
1844 extern float2 __attribute__((const, overloadable))
1845 fmin(float2 a, float b);
1847 extern float3 __attribute__((const, overloadable))
1848 fmin(float3 a, float b);
1850 extern float4 __attribute__((const, overloadable))
1851 fmin(float4 a, float b);
1853 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1854 extern half2 __attribute__((const, overloadable))
1855 fmin(half2 a, half b);
1858 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1859 extern half3 __attribute__((const, overloadable))
1860 fmin(half3 a, half b);
1863 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1864 extern half4 __attribute__((const, overloadable))
1865 fmin(half4 a, half b);
1871 * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
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).
1877 extern float __attribute__((const, overloadable))
1878 fmod(float numerator, float denominator);
1880 extern float2 __attribute__((const, overloadable))
1881 fmod(float2 numerator, float2 denominator);
1883 extern float3 __attribute__((const, overloadable))
1884 fmod(float3 numerator, float3 denominator);
1886 extern float4 __attribute__((const, overloadable))
1887 fmod(float4 numerator, float4 denominator);
1889 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1890 extern half __attribute__((const, overloadable))
1891 fmod(half numerator, half denominator);
1894 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1895 extern half2 __attribute__((const, overloadable))
1896 fmod(half2 numerator, half2 denominator);
1899 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1900 extern half3 __attribute__((const, overloadable))
1901 fmod(half3 numerator, half3 denominator);
1904 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1905 extern half4 __attribute__((const, overloadable))
1906 fmod(half4 numerator, half4 denominator);
1910 * fract: Positive fractional part
1912 * Returns the positive fractional part of v, i.e. v - floor(v).
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.
1919 * floor: If floor is not null, *floor will be set to the floor of v.
1921 extern float __attribute__((overloadable))
1922 fract(float v, float* floor);
1924 extern float2 __attribute__((overloadable))
1925 fract(float2 v, float2* floor);
1927 extern float3 __attribute__((overloadable))
1928 fract(float3 v, float3* floor);
1930 extern float4 __attribute__((overloadable))
1931 fract(float4 v, float4* floor);
1933 #if !defined(RS_VERSION) || (RS_VERSION <= 23)
1934 static inline float __attribute__((const, overloadable))
1937 return fract(v, &unused);
1941 #if !defined(RS_VERSION) || (RS_VERSION <= 23)
1942 static inline float2 __attribute__((const, overloadable))
1945 return fract(v, &unused);
1949 #if !defined(RS_VERSION) || (RS_VERSION <= 23)
1950 static inline float3 __attribute__((const, overloadable))
1953 return fract(v, &unused);
1957 #if !defined(RS_VERSION) || (RS_VERSION <= 23)
1958 static inline float4 __attribute__((const, overloadable))
1961 return fract(v, &unused);
1965 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1966 extern float __attribute__((overloadable))
1970 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1971 extern float2 __attribute__((overloadable))
1975 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1976 extern float3 __attribute__((overloadable))
1980 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1981 extern float4 __attribute__((overloadable))
1985 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1986 extern half __attribute__((overloadable))
1987 fract(half v, half* floor);
1990 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1991 extern half2 __attribute__((overloadable))
1992 fract(half2 v, half2* floor);
1995 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
1996 extern half3 __attribute__((overloadable))
1997 fract(half3 v, half3* floor);
2000 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2001 extern half4 __attribute__((overloadable))
2002 fract(half4 v, half4* floor);
2005 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2006 extern half __attribute__((overloadable))
2010 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2011 extern half2 __attribute__((overloadable))
2015 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2016 extern half3 __attribute__((overloadable))
2020 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2021 extern half4 __attribute__((overloadable))
2026 * frexp: Binary mantissa and exponent
2028 * Returns the binary mantissa and exponent of v, i.e. v == mantissa * 2 ^ exponent.
2030 * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
2032 * See ldexp() for the reverse operation. See also logb() and ilogb().
2036 * exponent: If exponent is not null, *exponent will be set to the exponent of v.
2038 extern float __attribute__((overloadable))
2039 frexp(float v, int* exponent);
2041 extern float2 __attribute__((overloadable))
2042 frexp(float2 v, int2* exponent);
2044 extern float3 __attribute__((overloadable))
2045 frexp(float3 v, int3* exponent);
2047 extern float4 __attribute__((overloadable))
2048 frexp(float4 v, int4* exponent);
2050 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2051 extern half __attribute__((overloadable))
2052 frexp(half v, int* exponent);
2055 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2056 extern half2 __attribute__((overloadable))
2057 frexp(half2 v, int2* exponent);
2060 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2061 extern half3 __attribute__((overloadable))
2062 frexp(half3 v, int3* exponent);
2065 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2066 extern half4 __attribute__((overloadable))
2067 frexp(half4 v, int4* exponent);
2071 * half_recip: Reciprocal computed to 16 bit precision
2073 * Returns the approximate reciprocal of a value.
2075 * The precision is that of a 16 bit floating point value.
2077 * See also native_recip().
2079 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2080 extern float __attribute__((const, overloadable))
2081 half_recip(float v);
2084 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2085 extern float2 __attribute__((const, overloadable))
2086 half_recip(float2 v);
2089 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2090 extern float3 __attribute__((const, overloadable))
2091 half_recip(float3 v);
2094 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2095 extern float4 __attribute__((const, overloadable))
2096 half_recip(float4 v);
2100 * half_rsqrt: Reciprocal of a square root computed to 16 bit precision
2102 * Returns the approximate value of (1.f / sqrt(value)).
2104 * The precision is that of a 16 bit floating point value.
2106 * See also rsqrt(), native_rsqrt().
2108 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2109 extern float __attribute__((const, overloadable))
2110 half_rsqrt(float v);
2113 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2114 extern float2 __attribute__((const, overloadable))
2115 half_rsqrt(float2 v);
2118 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2119 extern float3 __attribute__((const, overloadable))
2120 half_rsqrt(float3 v);
2123 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2124 extern float4 __attribute__((const, overloadable))
2125 half_rsqrt(float4 v);
2129 * half_sqrt: Square root computed to 16 bit precision
2131 * Returns the approximate square root of a value.
2133 * The precision is that of a 16 bit floating point value.
2135 * See also sqrt(), native_sqrt().
2137 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2138 extern float __attribute__((const, overloadable))
2142 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2143 extern float2 __attribute__((const, overloadable))
2144 half_sqrt(float2 v);
2147 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2148 extern float3 __attribute__((const, overloadable))
2149 half_sqrt(float3 v);
2152 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
2153 extern float4 __attribute__((const, overloadable))
2154 half_sqrt(float4 v);
2160 * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
2162 * See also native_hypot().
2164 extern float __attribute__((const, overloadable))
2165 hypot(float a, float b);
2167 extern float2 __attribute__((const, overloadable))
2168 hypot(float2 a, float2 b);
2170 extern float3 __attribute__((const, overloadable))
2171 hypot(float3 a, float3 b);
2173 extern float4 __attribute__((const, overloadable))
2174 hypot(float4 a, float4 b);
2176 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2177 extern half __attribute__((const, overloadable))
2178 hypot(half a, half b);
2181 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2182 extern half2 __attribute__((const, overloadable))
2183 hypot(half2 a, half2 b);
2186 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2187 extern half3 __attribute__((const, overloadable))
2188 hypot(half3 a, half3 b);
2191 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2192 extern half4 __attribute__((const, overloadable))
2193 hypot(half4 a, half4 b);
2197 * ilogb: Base two exponent
2199 * Returns the base two exponent of a value, where the mantissa is between
2200 * 1.f (inclusive) and 2.f (exclusive).
2202 * For example, ilogb(8.5f) returns 3.
2204 * Because of the difference in mantissa, this number is one less than is returned by frexp().
2206 * logb() is similar but returns a float.
2208 extern int __attribute__((const, overloadable))
2211 extern int2 __attribute__((const, overloadable))
2214 extern int3 __attribute__((const, overloadable))
2217 extern int4 __attribute__((const, overloadable))
2220 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2221 extern int __attribute__((const, overloadable))
2225 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2226 extern int2 __attribute__((const, overloadable))
2230 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2231 extern int3 __attribute__((const, overloadable))
2235 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2236 extern int4 __attribute__((const, overloadable))
2241 * ldexp: Creates a floating point from mantissa and exponent
2243 * Returns the floating point created from the mantissa and exponent,
2244 * i.e. (mantissa * 2 ^ exponent).
2246 * See frexp() for the reverse operation.
2249 * mantissa: Mantissa.
2250 * exponent: Exponent, a single component or matching vector.
2252 extern float __attribute__((const, overloadable))
2253 ldexp(float mantissa, int exponent);
2255 extern float2 __attribute__((const, overloadable))
2256 ldexp(float2 mantissa, int2 exponent);
2258 extern float3 __attribute__((const, overloadable))
2259 ldexp(float3 mantissa, int3 exponent);
2261 extern float4 __attribute__((const, overloadable))
2262 ldexp(float4 mantissa, int4 exponent);
2264 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2265 extern half __attribute__((const, overloadable))
2266 ldexp(half mantissa, int exponent);
2269 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2270 extern half2 __attribute__((const, overloadable))
2271 ldexp(half2 mantissa, int2 exponent);
2274 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2275 extern half3 __attribute__((const, overloadable))
2276 ldexp(half3 mantissa, int3 exponent);
2279 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2280 extern half4 __attribute__((const, overloadable))
2281 ldexp(half4 mantissa, int4 exponent);
2284 extern float2 __attribute__((const, overloadable))
2285 ldexp(float2 mantissa, int exponent);
2287 extern float3 __attribute__((const, overloadable))
2288 ldexp(float3 mantissa, int exponent);
2290 extern float4 __attribute__((const, overloadable))
2291 ldexp(float4 mantissa, int exponent);
2293 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2294 extern half2 __attribute__((const, overloadable))
2295 ldexp(half2 mantissa, int exponent);
2298 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2299 extern half3 __attribute__((const, overloadable))
2300 ldexp(half3 mantissa, int exponent);
2303 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2304 extern half4 __attribute__((const, overloadable))
2305 ldexp(half4 mantissa, int exponent);
2309 * lgamma: Natural logarithm of the gamma function
2311 * Returns the natural logarithm of the absolute value of the gamma function,
2312 * i.e. log(fabs(tgamma(v))).
2314 * See also tgamma().
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.
2319 extern float __attribute__((const, overloadable))
2322 extern float2 __attribute__((const, overloadable))
2325 extern float3 __attribute__((const, overloadable))
2328 extern float4 __attribute__((const, overloadable))
2331 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2332 extern half __attribute__((const, overloadable))
2336 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2337 extern half2 __attribute__((const, overloadable))
2341 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2342 extern half3 __attribute__((const, overloadable))
2346 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2347 extern half4 __attribute__((const, overloadable))
2351 extern float __attribute__((overloadable))
2352 lgamma(float v, int* sign_of_gamma);
2354 extern float2 __attribute__((overloadable))
2355 lgamma(float2 v, int2* sign_of_gamma);
2357 extern float3 __attribute__((overloadable))
2358 lgamma(float3 v, int3* sign_of_gamma);
2360 extern float4 __attribute__((overloadable))
2361 lgamma(float4 v, int4* sign_of_gamma);
2363 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2364 extern half __attribute__((overloadable))
2365 lgamma(half v, int* sign_of_gamma);
2368 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2369 extern half2 __attribute__((overloadable))
2370 lgamma(half2 v, int2* sign_of_gamma);
2373 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2374 extern half3 __attribute__((overloadable))
2375 lgamma(half3 v, int3* sign_of_gamma);
2378 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2379 extern half4 __attribute__((overloadable))
2380 lgamma(half4 v, int4* sign_of_gamma);
2384 * log: Natural logarithm
2386 * Returns the natural logarithm.
2388 * See also native_log().
2390 extern float __attribute__((const, overloadable))
2393 extern float2 __attribute__((const, overloadable))
2396 extern float3 __attribute__((const, overloadable))
2399 extern float4 __attribute__((const, overloadable))
2402 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2403 extern half __attribute__((const, overloadable))
2407 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2408 extern half2 __attribute__((const, overloadable))
2412 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2413 extern half3 __attribute__((const, overloadable))
2417 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2418 extern half4 __attribute__((const, overloadable))
2423 * log10: Base 10 logarithm
2425 * Returns the base 10 logarithm.
2427 * See also native_log10().
2429 extern float __attribute__((const, overloadable))
2432 extern float2 __attribute__((const, overloadable))
2435 extern float3 __attribute__((const, overloadable))
2438 extern float4 __attribute__((const, overloadable))
2441 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2442 extern half __attribute__((const, overloadable))
2446 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2447 extern half2 __attribute__((const, overloadable))
2451 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2452 extern half3 __attribute__((const, overloadable))
2456 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2457 extern half4 __attribute__((const, overloadable))
2462 * log1p: Natural logarithm of a value plus 1
2464 * Returns the natural logarithm of (v + 1.f).
2466 * See also native_log1p().
2468 extern float __attribute__((const, overloadable))
2471 extern float2 __attribute__((const, overloadable))
2474 extern float3 __attribute__((const, overloadable))
2477 extern float4 __attribute__((const, overloadable))
2480 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2481 extern half __attribute__((const, overloadable))
2485 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2486 extern half2 __attribute__((const, overloadable))
2490 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2491 extern half3 __attribute__((const, overloadable))
2495 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2496 extern half4 __attribute__((const, overloadable))
2501 * log2: Base 2 logarithm
2503 * Returns the base 2 logarithm.
2505 * See also native_log2().
2507 extern float __attribute__((const, overloadable))
2510 extern float2 __attribute__((const, overloadable))
2513 extern float3 __attribute__((const, overloadable))
2516 extern float4 __attribute__((const, overloadable))
2519 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2520 extern half __attribute__((const, overloadable))
2524 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2525 extern half2 __attribute__((const, overloadable))
2529 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2530 extern half3 __attribute__((const, overloadable))
2534 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2535 extern half4 __attribute__((const, overloadable))
2540 * logb: Base two exponent
2542 * Returns the base two exponent of a value, where the mantissa is between
2543 * 1.f (inclusive) and 2.f (exclusive).
2545 * For example, logb(8.5f) returns 3.f.
2547 * Because of the difference in mantissa, this number is one less than is returned by frexp().
2549 * ilogb() is similar but returns an integer.
2551 extern float __attribute__((const, overloadable))
2554 extern float2 __attribute__((const, overloadable))
2557 extern float3 __attribute__((const, overloadable))
2560 extern float4 __attribute__((const, overloadable))
2563 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2564 extern half __attribute__((const, overloadable))
2568 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2569 extern half2 __attribute__((const, overloadable))
2573 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2574 extern half3 __attribute__((const, overloadable))
2578 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2579 extern half4 __attribute__((const, overloadable))
2584 * mad: Multiply and add
2586 * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
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.
2592 extern float __attribute__((const, overloadable))
2593 mad(float multiplicand1, float multiplicand2, float offset);
2595 extern float2 __attribute__((const, overloadable))
2596 mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
2598 extern float3 __attribute__((const, overloadable))
2599 mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
2601 extern float4 __attribute__((const, overloadable))
2602 mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
2604 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2605 extern half __attribute__((const, overloadable))
2606 mad(half multiplicand1, half multiplicand2, half offset);
2609 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2610 extern half2 __attribute__((const, overloadable))
2611 mad(half2 multiplicand1, half2 multiplicand2, half2 offset);
2614 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2615 extern half3 __attribute__((const, overloadable))
2616 mad(half3 multiplicand1, half3 multiplicand2, half3 offset);
2619 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2620 extern half4 __attribute__((const, overloadable))
2621 mad(half4 multiplicand1, half4 multiplicand2, half4 offset);
2627 * Returns the maximum value of two arguments.
2629 extern float __attribute__((const, overloadable))
2630 max(float a, float b);
2632 extern float2 __attribute__((const, overloadable))
2633 max(float2 a, float2 b);
2635 extern float3 __attribute__((const, overloadable))
2636 max(float3 a, float3 b);
2638 extern float4 __attribute__((const, overloadable))
2639 max(float4 a, float4 b);
2641 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2642 extern half __attribute__((const, overloadable))
2643 max(half a, half b);
2646 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2647 extern half2 __attribute__((const, overloadable))
2648 max(half2 a, half2 b);
2651 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2652 extern half3 __attribute__((const, overloadable))
2653 max(half3 a, half3 b);
2656 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2657 extern half4 __attribute__((const, overloadable))
2658 max(half4 a, half4 b);
2661 extern float2 __attribute__((const, overloadable))
2662 max(float2 a, float b);
2664 extern float3 __attribute__((const, overloadable))
2665 max(float3 a, float b);
2667 extern float4 __attribute__((const, overloadable))
2668 max(float4 a, float b);
2670 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2671 extern half2 __attribute__((const, overloadable))
2672 max(half2 a, half b);
2675 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2676 extern half3 __attribute__((const, overloadable))
2677 max(half3 a, half b);
2680 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
2681 extern half4 __attribute__((const, overloadable))
2682 max(half4 a, half b);
2685 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2686 static inline char __attribute__((const, overloadable))
2687 max(char a, char b) {
2688 return (a > b ? a : b);
2692 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2693 static inline uchar __attribute__((const, overloadable))
2694 max(uchar a, uchar b) {
2695 return (a > b ? a : b);
2699 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2700 static inline short __attribute__((const, overloadable))
2701 max(short a, short b) {
2702 return (a > b ? a : b);
2706 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2707 static inline ushort __attribute__((const, overloadable))
2708 max(ushort a, ushort b) {
2709 return (a > b ? a : b);
2713 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2714 static inline int __attribute__((const, overloadable))
2716 return (a > b ? a : b);
2720 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2721 static inline uint __attribute__((const, overloadable))
2722 max(uint a, uint b) {
2723 return (a > b ? a : b);
2727 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2728 static inline char2 __attribute__((const, overloadable))
2729 max(char2 a, char2 b) {
2731 tmp.x = (a.x > b.x ? a.x : b.x);
2732 tmp.y = (a.y > b.y ? a.y : b.y);
2737 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2738 static inline uchar2 __attribute__((const, overloadable))
2739 max(uchar2 a, uchar2 b) {
2741 tmp.x = (a.x > b.x ? a.x : b.x);
2742 tmp.y = (a.y > b.y ? a.y : b.y);
2747 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2748 static inline short2 __attribute__((const, overloadable))
2749 max(short2 a, short2 b) {
2751 tmp.x = (a.x > b.x ? a.x : b.x);
2752 tmp.y = (a.y > b.y ? a.y : b.y);
2757 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2758 static inline ushort2 __attribute__((const, overloadable))
2759 max(ushort2 a, ushort2 b) {
2761 tmp.x = (a.x > b.x ? a.x : b.x);
2762 tmp.y = (a.y > b.y ? a.y : b.y);
2767 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2768 static inline int2 __attribute__((const, overloadable))
2769 max(int2 a, int2 b) {
2771 tmp.x = (a.x > b.x ? a.x : b.x);
2772 tmp.y = (a.y > b.y ? a.y : b.y);
2777 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2778 static inline uint2 __attribute__((const, overloadable))
2779 max(uint2 a, uint2 b) {
2781 tmp.x = (a.x > b.x ? a.x : b.x);
2782 tmp.y = (a.y > b.y ? a.y : b.y);
2787 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2788 static inline char3 __attribute__((const, overloadable))
2789 max(char3 a, char3 b) {
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);
2798 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2799 static inline uchar3 __attribute__((const, overloadable))
2800 max(uchar3 a, uchar3 b) {
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);
2809 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2810 static inline short3 __attribute__((const, overloadable))
2811 max(short3 a, short3 b) {
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);
2820 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2821 static inline ushort3 __attribute__((const, overloadable))
2822 max(ushort3 a, ushort3 b) {
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);
2831 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2832 static inline int3 __attribute__((const, overloadable))
2833 max(int3 a, int3 b) {
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);
2842 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2843 static inline uint3 __attribute__((const, overloadable))
2844 max(uint3 a, uint3 b) {
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);
2853 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2854 static inline char4 __attribute__((const, overloadable))
2855 max(char4 a, char4 b) {
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);
2865 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2866 static inline uchar4 __attribute__((const, overloadable))
2867 max(uchar4 a, uchar4 b) {
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);
2877 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2878 static inline short4 __attribute__((const, overloadable))
2879 max(short4 a, short4 b) {
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);
2889 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2890 static inline ushort4 __attribute__((const, overloadable))
2891 max(ushort4 a, ushort4 b) {
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);
2901 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2902 static inline int4 __attribute__((const, overloadable))
2903 max(int4 a, int4 b) {
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);
2913 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
2914 static inline uint4 __attribute__((const, overloadable))
2915 max(uint4 a, uint4 b) {
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);
2925 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2926 extern char __attribute__((const, overloadable))
2927 max(char a, char b);
2930 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2931 extern char2 __attribute__((const, overloadable))
2932 max(char2 a, char2 b);
2935 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2936 extern char3 __attribute__((const, overloadable))
2937 max(char3 a, char3 b);
2940 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2941 extern char4 __attribute__((const, overloadable))
2942 max(char4 a, char4 b);
2945 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2946 extern uchar __attribute__((const, overloadable))
2947 max(uchar a, uchar b);
2950 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2951 extern uchar2 __attribute__((const, overloadable))
2952 max(uchar2 a, uchar2 b);
2955 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2956 extern uchar3 __attribute__((const, overloadable))
2957 max(uchar3 a, uchar3 b);
2960 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2961 extern uchar4 __attribute__((const, overloadable))
2962 max(uchar4 a, uchar4 b);
2965 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2966 extern short __attribute__((const, overloadable))
2967 max(short a, short b);
2970 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2971 extern short2 __attribute__((const, overloadable))
2972 max(short2 a, short2 b);
2975 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2976 extern short3 __attribute__((const, overloadable))
2977 max(short3 a, short3 b);
2980 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2981 extern short4 __attribute__((const, overloadable))
2982 max(short4 a, short4 b);
2985 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2986 extern ushort __attribute__((const, overloadable))
2987 max(ushort a, ushort b);
2990 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2991 extern ushort2 __attribute__((const, overloadable))
2992 max(ushort2 a, ushort2 b);
2995 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
2996 extern ushort3 __attribute__((const, overloadable))
2997 max(ushort3 a, ushort3 b);
3000 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3001 extern ushort4 __attribute__((const, overloadable))
3002 max(ushort4 a, ushort4 b);
3005 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3006 extern int __attribute__((const, overloadable))
3010 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3011 extern int2 __attribute__((const, overloadable))
3012 max(int2 a, int2 b);
3015 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3016 extern int3 __attribute__((const, overloadable))
3017 max(int3 a, int3 b);
3020 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3021 extern int4 __attribute__((const, overloadable))
3022 max(int4 a, int4 b);
3025 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3026 extern uint __attribute__((const, overloadable))
3027 max(uint a, uint b);
3030 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3031 extern uint2 __attribute__((const, overloadable))
3032 max(uint2 a, uint2 b);
3035 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3036 extern uint3 __attribute__((const, overloadable))
3037 max(uint3 a, uint3 b);
3040 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3041 extern uint4 __attribute__((const, overloadable))
3042 max(uint4 a, uint4 b);
3045 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3046 extern long __attribute__((const, overloadable))
3047 max(long a, long b);
3050 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3051 extern long2 __attribute__((const, overloadable))
3052 max(long2 a, long2 b);
3055 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3056 extern long3 __attribute__((const, overloadable))
3057 max(long3 a, long3 b);
3060 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3061 extern long4 __attribute__((const, overloadable))
3062 max(long4 a, long4 b);
3065 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3066 extern ulong __attribute__((const, overloadable))
3067 max(ulong a, ulong b);
3070 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3071 extern ulong2 __attribute__((const, overloadable))
3072 max(ulong2 a, ulong2 b);
3075 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3076 extern ulong3 __attribute__((const, overloadable))
3077 max(ulong3 a, ulong3 b);
3080 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3081 extern ulong4 __attribute__((const, overloadable))
3082 max(ulong4 a, ulong4 b);
3088 * Returns the minimum value of two arguments.
3090 extern float __attribute__((const, overloadable))
3091 min(float a, float b);
3093 extern float2 __attribute__((const, overloadable))
3094 min(float2 a, float2 b);
3096 extern float3 __attribute__((const, overloadable))
3097 min(float3 a, float3 b);
3099 extern float4 __attribute__((const, overloadable))
3100 min(float4 a, float4 b);
3102 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3103 extern half __attribute__((const, overloadable))
3104 min(half a, half b);
3107 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3108 extern half2 __attribute__((const, overloadable))
3109 min(half2 a, half2 b);
3112 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3113 extern half3 __attribute__((const, overloadable))
3114 min(half3 a, half3 b);
3117 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3118 extern half4 __attribute__((const, overloadable))
3119 min(half4 a, half4 b);
3122 extern float2 __attribute__((const, overloadable))
3123 min(float2 a, float b);
3125 extern float3 __attribute__((const, overloadable))
3126 min(float3 a, float b);
3128 extern float4 __attribute__((const, overloadable))
3129 min(float4 a, float b);
3131 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3132 extern half2 __attribute__((const, overloadable))
3133 min(half2 a, half b);
3136 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3137 extern half3 __attribute__((const, overloadable))
3138 min(half3 a, half b);
3141 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3142 extern half4 __attribute__((const, overloadable))
3143 min(half4 a, half b);
3146 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3147 static inline char __attribute__((const, overloadable))
3148 min(char a, char b) {
3149 return (a < b ? a : b);
3153 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3154 static inline uchar __attribute__((const, overloadable))
3155 min(uchar a, uchar b) {
3156 return (a < b ? a : b);
3160 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3161 static inline short __attribute__((const, overloadable))
3162 min(short a, short b) {
3163 return (a < b ? a : b);
3167 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3168 static inline ushort __attribute__((const, overloadable))
3169 min(ushort a, ushort b) {
3170 return (a < b ? a : b);
3174 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3175 static inline int __attribute__((const, overloadable))
3177 return (a < b ? a : b);
3181 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3182 static inline uint __attribute__((const, overloadable))
3183 min(uint a, uint b) {
3184 return (a < b ? a : b);
3188 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3189 static inline char2 __attribute__((const, overloadable))
3190 min(char2 a, char2 b) {
3192 tmp.x = (a.x < b.x ? a.x : b.x);
3193 tmp.y = (a.y < b.y ? a.y : b.y);
3198 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3199 static inline uchar2 __attribute__((const, overloadable))
3200 min(uchar2 a, uchar2 b) {
3202 tmp.x = (a.x < b.x ? a.x : b.x);
3203 tmp.y = (a.y < b.y ? a.y : b.y);
3208 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3209 static inline short2 __attribute__((const, overloadable))
3210 min(short2 a, short2 b) {
3212 tmp.x = (a.x < b.x ? a.x : b.x);
3213 tmp.y = (a.y < b.y ? a.y : b.y);
3218 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3219 static inline ushort2 __attribute__((const, overloadable))
3220 min(ushort2 a, ushort2 b) {
3222 tmp.x = (a.x < b.x ? a.x : b.x);
3223 tmp.y = (a.y < b.y ? a.y : b.y);
3228 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3229 static inline int2 __attribute__((const, overloadable))
3230 min(int2 a, int2 b) {
3232 tmp.x = (a.x < b.x ? a.x : b.x);
3233 tmp.y = (a.y < b.y ? a.y : b.y);
3238 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3239 static inline uint2 __attribute__((const, overloadable))
3240 min(uint2 a, uint2 b) {
3242 tmp.x = (a.x < b.x ? a.x : b.x);
3243 tmp.y = (a.y < b.y ? a.y : b.y);
3248 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3249 static inline char3 __attribute__((const, overloadable))
3250 min(char3 a, char3 b) {
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);
3259 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3260 static inline uchar3 __attribute__((const, overloadable))
3261 min(uchar3 a, uchar3 b) {
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);
3270 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3271 static inline short3 __attribute__((const, overloadable))
3272 min(short3 a, short3 b) {
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);
3281 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3282 static inline ushort3 __attribute__((const, overloadable))
3283 min(ushort3 a, ushort3 b) {
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);
3292 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3293 static inline int3 __attribute__((const, overloadable))
3294 min(int3 a, int3 b) {
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);
3303 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3304 static inline uint3 __attribute__((const, overloadable))
3305 min(uint3 a, uint3 b) {
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);
3314 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3315 static inline char4 __attribute__((const, overloadable))
3316 min(char4 a, char4 b) {
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);
3326 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3327 static inline uchar4 __attribute__((const, overloadable))
3328 min(uchar4 a, uchar4 b) {
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);
3338 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3339 static inline short4 __attribute__((const, overloadable))
3340 min(short4 a, short4 b) {
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);
3350 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3351 static inline ushort4 __attribute__((const, overloadable))
3352 min(ushort4 a, ushort4 b) {
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);
3362 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3363 static inline int4 __attribute__((const, overloadable))
3364 min(int4 a, int4 b) {
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);
3374 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
3375 static inline uint4 __attribute__((const, overloadable))
3376 min(uint4 a, uint4 b) {
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);
3386 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3387 extern char __attribute__((const, overloadable))
3388 min(char a, char b);
3391 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3392 extern char2 __attribute__((const, overloadable))
3393 min(char2 a, char2 b);
3396 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3397 extern char3 __attribute__((const, overloadable))
3398 min(char3 a, char3 b);
3401 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3402 extern char4 __attribute__((const, overloadable))
3403 min(char4 a, char4 b);
3406 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3407 extern uchar __attribute__((const, overloadable))
3408 min(uchar a, uchar b);
3411 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3412 extern uchar2 __attribute__((const, overloadable))
3413 min(uchar2 a, uchar2 b);
3416 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3417 extern uchar3 __attribute__((const, overloadable))
3418 min(uchar3 a, uchar3 b);
3421 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3422 extern uchar4 __attribute__((const, overloadable))
3423 min(uchar4 a, uchar4 b);
3426 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3427 extern short __attribute__((const, overloadable))
3428 min(short a, short b);
3431 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3432 extern short2 __attribute__((const, overloadable))
3433 min(short2 a, short2 b);
3436 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3437 extern short3 __attribute__((const, overloadable))
3438 min(short3 a, short3 b);
3441 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3442 extern short4 __attribute__((const, overloadable))
3443 min(short4 a, short4 b);
3446 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3447 extern ushort __attribute__((const, overloadable))
3448 min(ushort a, ushort b);
3451 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3452 extern ushort2 __attribute__((const, overloadable))
3453 min(ushort2 a, ushort2 b);
3456 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3457 extern ushort3 __attribute__((const, overloadable))
3458 min(ushort3 a, ushort3 b);
3461 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3462 extern ushort4 __attribute__((const, overloadable))
3463 min(ushort4 a, ushort4 b);
3466 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3467 extern int __attribute__((const, overloadable))
3471 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3472 extern int2 __attribute__((const, overloadable))
3473 min(int2 a, int2 b);
3476 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3477 extern int3 __attribute__((const, overloadable))
3478 min(int3 a, int3 b);
3481 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3482 extern int4 __attribute__((const, overloadable))
3483 min(int4 a, int4 b);
3486 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3487 extern uint __attribute__((const, overloadable))
3488 min(uint a, uint b);
3491 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3492 extern uint2 __attribute__((const, overloadable))
3493 min(uint2 a, uint2 b);
3496 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3497 extern uint3 __attribute__((const, overloadable))
3498 min(uint3 a, uint3 b);
3501 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3502 extern uint4 __attribute__((const, overloadable))
3503 min(uint4 a, uint4 b);
3506 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3507 extern long __attribute__((const, overloadable))
3508 min(long a, long b);
3511 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3512 extern long2 __attribute__((const, overloadable))
3513 min(long2 a, long2 b);
3516 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3517 extern long3 __attribute__((const, overloadable))
3518 min(long3 a, long3 b);
3521 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3522 extern long4 __attribute__((const, overloadable))
3523 min(long4 a, long4 b);
3526 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3527 extern ulong __attribute__((const, overloadable))
3528 min(ulong a, ulong b);
3531 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3532 extern ulong2 __attribute__((const, overloadable))
3533 min(ulong2 a, ulong2 b);
3536 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3537 extern ulong3 __attribute__((const, overloadable))
3538 min(ulong3 a, ulong3 b);
3541 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3542 extern ulong4 __attribute__((const, overloadable))
3543 min(ulong4 a, ulong4 b);
3547 * mix: Mixes two values
3549 * Returns start + ((stop - start) * fraction).
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).
3554 extern float __attribute__((const, overloadable))
3555 mix(float start, float stop, float fraction);
3557 extern float2 __attribute__((const, overloadable))
3558 mix(float2 start, float2 stop, float2 fraction);
3560 extern float3 __attribute__((const, overloadable))
3561 mix(float3 start, float3 stop, float3 fraction);
3563 extern float4 __attribute__((const, overloadable))
3564 mix(float4 start, float4 stop, float4 fraction);
3566 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3567 extern half __attribute__((const, overloadable))
3568 mix(half start, half stop, half fraction);
3571 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3572 extern half2 __attribute__((const, overloadable))
3573 mix(half2 start, half2 stop, half2 fraction);
3576 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3577 extern half3 __attribute__((const, overloadable))
3578 mix(half3 start, half3 stop, half3 fraction);
3581 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3582 extern half4 __attribute__((const, overloadable))
3583 mix(half4 start, half4 stop, half4 fraction);
3586 extern float2 __attribute__((const, overloadable))
3587 mix(float2 start, float2 stop, float fraction);
3589 extern float3 __attribute__((const, overloadable))
3590 mix(float3 start, float3 stop, float fraction);
3592 extern float4 __attribute__((const, overloadable))
3593 mix(float4 start, float4 stop, float fraction);
3595 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3596 extern half2 __attribute__((const, overloadable))
3597 mix(half2 start, half2 stop, half fraction);
3600 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3601 extern half3 __attribute__((const, overloadable))
3602 mix(half3 start, half3 stop, half fraction);
3605 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3606 extern half4 __attribute__((const, overloadable))
3607 mix(half4 start, half4 stop, half fraction);
3611 * modf: Integral and fractional components
3613 * Returns the integral and fractional components of a number.
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.
3620 * integral_part: *integral_part will be set to the integral portion of the number.
3622 * Returns: Floating point portion of the value.
3624 extern float __attribute__((overloadable))
3625 modf(float v, float* integral_part);
3627 extern float2 __attribute__((overloadable))
3628 modf(float2 v, float2* integral_part);
3630 extern float3 __attribute__((overloadable))
3631 modf(float3 v, float3* integral_part);
3633 extern float4 __attribute__((overloadable))
3634 modf(float4 v, float4* integral_part);
3636 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3637 extern half __attribute__((overloadable))
3638 modf(half v, half* integral_part);
3641 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3642 extern half2 __attribute__((overloadable))
3643 modf(half2 v, half2* integral_part);
3646 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3647 extern half3 __attribute__((overloadable))
3648 modf(half3 v, half3* integral_part);
3651 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3652 extern half4 __attribute__((overloadable))
3653 modf(half4 v, half4* integral_part);
3659 * Returns a NaN value (Not a Number).
3664 extern float __attribute__((const, overloadable))
3668 * nan_half: Not a Number
3670 * Returns a half-precision floating point NaN value (Not a Number).
3672 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3673 extern half __attribute__((const, overloadable))
3678 * native_acos: Approximate inverse cosine
3680 * Returns the approximate inverse cosine, in radians.
3682 * This function yields undefined results from input values less than -1 or greater than 1.
3686 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3687 extern float __attribute__((const, overloadable))
3688 native_acos(float v);
3691 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3692 extern float2 __attribute__((const, overloadable))
3693 native_acos(float2 v);
3696 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3697 extern float3 __attribute__((const, overloadable))
3698 native_acos(float3 v);
3701 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3702 extern float4 __attribute__((const, overloadable))
3703 native_acos(float4 v);
3706 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3707 extern half __attribute__((const, overloadable))
3708 native_acos(half v);
3711 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3712 extern half2 __attribute__((const, overloadable))
3713 native_acos(half2 v);
3716 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3717 extern half3 __attribute__((const, overloadable))
3718 native_acos(half3 v);
3721 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3722 extern half4 __attribute__((const, overloadable))
3723 native_acos(half4 v);
3727 * native_acosh: Approximate inverse hyperbolic cosine
3729 * Returns the approximate inverse hyperbolic cosine, in radians.
3733 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3734 extern float __attribute__((const, overloadable))
3735 native_acosh(float v);
3738 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3739 extern float2 __attribute__((const, overloadable))
3740 native_acosh(float2 v);
3743 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3744 extern float3 __attribute__((const, overloadable))
3745 native_acosh(float3 v);
3748 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3749 extern float4 __attribute__((const, overloadable))
3750 native_acosh(float4 v);
3753 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3754 extern half __attribute__((const, overloadable))
3755 native_acosh(half v);
3758 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3759 extern half2 __attribute__((const, overloadable))
3760 native_acosh(half2 v);
3763 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3764 extern half3 __attribute__((const, overloadable))
3765 native_acosh(half3 v);
3768 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3769 extern half4 __attribute__((const, overloadable))
3770 native_acosh(half4 v);
3774 * native_acospi: Approximate inverse cosine divided by pi
3776 * Returns the approximate inverse cosine in radians, divided by pi.
3778 * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
3780 * This function yields undefined results from input values less than -1 or greater than 1.
3782 * See also acospi().
3784 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3785 extern float __attribute__((const, overloadable))
3786 native_acospi(float v);
3789 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3790 extern float2 __attribute__((const, overloadable))
3791 native_acospi(float2 v);
3794 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3795 extern float3 __attribute__((const, overloadable))
3796 native_acospi(float3 v);
3799 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3800 extern float4 __attribute__((const, overloadable))
3801 native_acospi(float4 v);
3804 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3805 extern half __attribute__((const, overloadable))
3806 native_acospi(half v);
3809 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3810 extern half2 __attribute__((const, overloadable))
3811 native_acospi(half2 v);
3814 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3815 extern half3 __attribute__((const, overloadable))
3816 native_acospi(half3 v);
3819 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3820 extern half4 __attribute__((const, overloadable))
3821 native_acospi(half4 v);
3825 * native_asin: Approximate inverse sine
3827 * Returns the approximate inverse sine, in radians.
3829 * This function yields undefined results from input values less than -1 or greater than 1.
3833 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3834 extern float __attribute__((const, overloadable))
3835 native_asin(float v);
3838 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3839 extern float2 __attribute__((const, overloadable))
3840 native_asin(float2 v);
3843 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3844 extern float3 __attribute__((const, overloadable))
3845 native_asin(float3 v);
3848 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3849 extern float4 __attribute__((const, overloadable))
3850 native_asin(float4 v);
3853 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3854 extern half __attribute__((const, overloadable))
3855 native_asin(half v);
3858 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3859 extern half2 __attribute__((const, overloadable))
3860 native_asin(half2 v);
3863 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3864 extern half3 __attribute__((const, overloadable))
3865 native_asin(half3 v);
3868 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3869 extern half4 __attribute__((const, overloadable))
3870 native_asin(half4 v);
3874 * native_asinh: Approximate inverse hyperbolic sine
3876 * Returns the approximate inverse hyperbolic sine, in radians.
3880 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3881 extern float __attribute__((const, overloadable))
3882 native_asinh(float v);
3885 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3886 extern float2 __attribute__((const, overloadable))
3887 native_asinh(float2 v);
3890 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3891 extern float3 __attribute__((const, overloadable))
3892 native_asinh(float3 v);
3895 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3896 extern float4 __attribute__((const, overloadable))
3897 native_asinh(float4 v);
3900 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3901 extern half __attribute__((const, overloadable))
3902 native_asinh(half v);
3905 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3906 extern half2 __attribute__((const, overloadable))
3907 native_asinh(half2 v);
3910 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3911 extern half3 __attribute__((const, overloadable))
3912 native_asinh(half3 v);
3915 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3916 extern half4 __attribute__((const, overloadable))
3917 native_asinh(half4 v);
3921 * native_asinpi: Approximate inverse sine divided by pi
3923 * Returns the approximate inverse sine in radians, divided by pi.
3925 * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
3927 * This function yields undefined results from input values less than -1 or greater than 1.
3929 * See also asinpi().
3931 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3932 extern float __attribute__((const, overloadable))
3933 native_asinpi(float v);
3936 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3937 extern float2 __attribute__((const, overloadable))
3938 native_asinpi(float2 v);
3941 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3942 extern float3 __attribute__((const, overloadable))
3943 native_asinpi(float3 v);
3946 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3947 extern float4 __attribute__((const, overloadable))
3948 native_asinpi(float4 v);
3951 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3952 extern half __attribute__((const, overloadable))
3953 native_asinpi(half v);
3956 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3957 extern half2 __attribute__((const, overloadable))
3958 native_asinpi(half2 v);
3961 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3962 extern half3 __attribute__((const, overloadable))
3963 native_asinpi(half3 v);
3966 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3967 extern half4 __attribute__((const, overloadable))
3968 native_asinpi(half4 v);
3972 * native_atan: Approximate inverse tangent
3974 * Returns the approximate inverse tangent, in radians.
3978 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3979 extern float __attribute__((const, overloadable))
3980 native_atan(float v);
3983 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3984 extern float2 __attribute__((const, overloadable))
3985 native_atan(float2 v);
3988 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3989 extern float3 __attribute__((const, overloadable))
3990 native_atan(float3 v);
3993 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
3994 extern float4 __attribute__((const, overloadable))
3995 native_atan(float4 v);
3998 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
3999 extern half __attribute__((const, overloadable))
4000 native_atan(half v);
4003 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4004 extern half2 __attribute__((const, overloadable))
4005 native_atan(half2 v);
4008 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4009 extern half3 __attribute__((const, overloadable))
4010 native_atan(half3 v);
4013 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4014 extern half4 __attribute__((const, overloadable))
4015 native_atan(half4 v);
4019 * native_atan2: Approximate inverse tangent of a ratio
4021 * Returns the approximate inverse tangent of (numerator / denominator), in radians.
4026 * numerator: Numerator.
4027 * denominator: Denominator. Can be 0.
4029 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4030 extern float __attribute__((const, overloadable))
4031 native_atan2(float numerator, float denominator);
4034 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4035 extern float2 __attribute__((const, overloadable))
4036 native_atan2(float2 numerator, float2 denominator);
4039 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4040 extern float3 __attribute__((const, overloadable))
4041 native_atan2(float3 numerator, float3 denominator);
4044 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4045 extern float4 __attribute__((const, overloadable))
4046 native_atan2(float4 numerator, float4 denominator);
4049 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4050 extern half __attribute__((const, overloadable))
4051 native_atan2(half numerator, half denominator);
4054 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4055 extern half2 __attribute__((const, overloadable))
4056 native_atan2(half2 numerator, half2 denominator);
4059 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4060 extern half3 __attribute__((const, overloadable))
4061 native_atan2(half3 numerator, half3 denominator);
4064 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4065 extern half4 __attribute__((const, overloadable))
4066 native_atan2(half4 numerator, half4 denominator);
4070 * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi
4072 * Returns the approximate inverse tangent of (numerator / denominator),
4073 * in radians, divided by pi.
4075 * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
4077 * See also atan2pi().
4080 * numerator: Numerator.
4081 * denominator: Denominator. Can be 0.
4083 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4084 extern float __attribute__((const, overloadable))
4085 native_atan2pi(float numerator, float denominator);
4088 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4089 extern float2 __attribute__((const, overloadable))
4090 native_atan2pi(float2 numerator, float2 denominator);
4093 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4094 extern float3 __attribute__((const, overloadable))
4095 native_atan2pi(float3 numerator, float3 denominator);
4098 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4099 extern float4 __attribute__((const, overloadable))
4100 native_atan2pi(float4 numerator, float4 denominator);
4103 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4104 extern half __attribute__((const, overloadable))
4105 native_atan2pi(half numerator, half denominator);
4108 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4109 extern half2 __attribute__((const, overloadable))
4110 native_atan2pi(half2 numerator, half2 denominator);
4113 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4114 extern half3 __attribute__((const, overloadable))
4115 native_atan2pi(half3 numerator, half3 denominator);
4118 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4119 extern half4 __attribute__((const, overloadable))
4120 native_atan2pi(half4 numerator, half4 denominator);
4124 * native_atanh: Approximate inverse hyperbolic tangent
4126 * Returns the approximate inverse hyperbolic tangent, in radians.
4130 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4131 extern float __attribute__((const, overloadable))
4132 native_atanh(float v);
4135 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4136 extern float2 __attribute__((const, overloadable))
4137 native_atanh(float2 v);
4140 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4141 extern float3 __attribute__((const, overloadable))
4142 native_atanh(float3 v);
4145 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4146 extern float4 __attribute__((const, overloadable))
4147 native_atanh(float4 v);
4150 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4151 extern half __attribute__((const, overloadable))
4152 native_atanh(half v);
4155 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4156 extern half2 __attribute__((const, overloadable))
4157 native_atanh(half2 v);
4160 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4161 extern half3 __attribute__((const, overloadable))
4162 native_atanh(half3 v);
4165 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4166 extern half4 __attribute__((const, overloadable))
4167 native_atanh(half4 v);
4171 * native_atanpi: Approximate inverse tangent divided by pi
4173 * Returns the approximate inverse tangent in radians, divided by pi.
4175 * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
4177 * See also atanpi().
4179 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4180 extern float __attribute__((const, overloadable))
4181 native_atanpi(float v);
4184 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4185 extern float2 __attribute__((const, overloadable))
4186 native_atanpi(float2 v);
4189 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4190 extern float3 __attribute__((const, overloadable))
4191 native_atanpi(float3 v);
4194 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4195 extern float4 __attribute__((const, overloadable))
4196 native_atanpi(float4 v);
4199 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4200 extern half __attribute__((const, overloadable))
4201 native_atanpi(half v);
4204 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4205 extern half2 __attribute__((const, overloadable))
4206 native_atanpi(half2 v);
4209 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4210 extern half3 __attribute__((const, overloadable))
4211 native_atanpi(half3 v);
4214 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4215 extern half4 __attribute__((const, overloadable))
4216 native_atanpi(half4 v);
4220 * native_cbrt: Approximate cube root
4222 * Returns the approximate cubic root.
4226 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4227 extern float __attribute__((const, overloadable))
4228 native_cbrt(float v);
4231 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4232 extern float2 __attribute__((const, overloadable))
4233 native_cbrt(float2 v);
4236 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4237 extern float3 __attribute__((const, overloadable))
4238 native_cbrt(float3 v);
4241 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4242 extern float4 __attribute__((const, overloadable))
4243 native_cbrt(float4 v);
4246 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4247 extern half __attribute__((const, overloadable))
4248 native_cbrt(half v);
4251 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4252 extern half2 __attribute__((const, overloadable))
4253 native_cbrt(half2 v);
4256 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4257 extern half3 __attribute__((const, overloadable))
4258 native_cbrt(half3 v);
4261 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4262 extern half4 __attribute__((const, overloadable))
4263 native_cbrt(half4 v);
4267 * native_cos: Approximate cosine
4269 * Returns the approximate cosine of an angle measured in radians.
4273 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4274 extern float __attribute__((const, overloadable))
4275 native_cos(float v);
4278 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4279 extern float2 __attribute__((const, overloadable))
4280 native_cos(float2 v);
4283 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4284 extern float3 __attribute__((const, overloadable))
4285 native_cos(float3 v);
4288 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4289 extern float4 __attribute__((const, overloadable))
4290 native_cos(float4 v);
4293 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4294 extern half __attribute__((const, overloadable))
4298 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4299 extern half2 __attribute__((const, overloadable))
4300 native_cos(half2 v);
4303 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4304 extern half3 __attribute__((const, overloadable))
4305 native_cos(half3 v);
4308 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4309 extern half4 __attribute__((const, overloadable))
4310 native_cos(half4 v);
4314 * native_cosh: Approximate hypebolic cosine
4316 * Returns the approximate hypebolic cosine.
4320 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4321 extern float __attribute__((const, overloadable))
4322 native_cosh(float v);
4325 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4326 extern float2 __attribute__((const, overloadable))
4327 native_cosh(float2 v);
4330 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4331 extern float3 __attribute__((const, overloadable))
4332 native_cosh(float3 v);
4335 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4336 extern float4 __attribute__((const, overloadable))
4337 native_cosh(float4 v);
4340 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4341 extern half __attribute__((const, overloadable))
4342 native_cosh(half v);
4345 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4346 extern half2 __attribute__((const, overloadable))
4347 native_cosh(half2 v);
4350 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4351 extern half3 __attribute__((const, overloadable))
4352 native_cosh(half3 v);
4355 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4356 extern half4 __attribute__((const, overloadable))
4357 native_cosh(half4 v);
4361 * native_cospi: Approximate cosine of a number multiplied by pi
4363 * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
4365 * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
4369 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4370 extern float __attribute__((const, overloadable))
4371 native_cospi(float v);
4374 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4375 extern float2 __attribute__((const, overloadable))
4376 native_cospi(float2 v);
4379 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4380 extern float3 __attribute__((const, overloadable))
4381 native_cospi(float3 v);
4384 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4385 extern float4 __attribute__((const, overloadable))
4386 native_cospi(float4 v);
4389 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4390 extern half __attribute__((const, overloadable))
4391 native_cospi(half v);
4394 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4395 extern half2 __attribute__((const, overloadable))
4396 native_cospi(half2 v);
4399 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4400 extern half3 __attribute__((const, overloadable))
4401 native_cospi(half3 v);
4404 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4405 extern half4 __attribute__((const, overloadable))
4406 native_cospi(half4 v);
4410 * native_divide: Approximate division
4412 * Computes the approximate division of two values.
4414 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4415 extern float __attribute__((const, overloadable))
4416 native_divide(float left_vector, float right_vector);
4419 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4420 extern float2 __attribute__((const, overloadable))
4421 native_divide(float2 left_vector, float2 right_vector);
4424 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4425 extern float3 __attribute__((const, overloadable))
4426 native_divide(float3 left_vector, float3 right_vector);
4429 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4430 extern float4 __attribute__((const, overloadable))
4431 native_divide(float4 left_vector, float4 right_vector);
4434 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4435 extern half __attribute__((const, overloadable))
4436 native_divide(half left_vector, half right_vector);
4439 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4440 extern half2 __attribute__((const, overloadable))
4441 native_divide(half2 left_vector, half2 right_vector);
4444 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4445 extern half3 __attribute__((const, overloadable))
4446 native_divide(half3 left_vector, half3 right_vector);
4449 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4450 extern half4 __attribute__((const, overloadable))
4451 native_divide(half4 left_vector, half4 right_vector);
4455 * native_exp: Approximate e raised to a number
4457 * Fast approximate exp.
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.
4464 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4465 extern float __attribute__((const, overloadable))
4466 native_exp(float v);
4469 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4470 extern float2 __attribute__((const, overloadable))
4471 native_exp(float2 v);
4474 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4475 extern float3 __attribute__((const, overloadable))
4476 native_exp(float3 v);
4479 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4480 extern float4 __attribute__((const, overloadable))
4481 native_exp(float4 v);
4484 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4485 extern half __attribute__((const, overloadable))
4489 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4490 extern half2 __attribute__((const, overloadable))
4491 native_exp(half2 v);
4494 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4495 extern half3 __attribute__((const, overloadable))
4496 native_exp(half3 v);
4499 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4500 extern half4 __attribute__((const, overloadable))
4501 native_exp(half4 v);
4505 * native_exp10: Approximate 10 raised to a number
4507 * Fast approximate exp10.
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.
4514 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4515 extern float __attribute__((const, overloadable))
4516 native_exp10(float v);
4519 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4520 extern float2 __attribute__((const, overloadable))
4521 native_exp10(float2 v);
4524 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4525 extern float3 __attribute__((const, overloadable))
4526 native_exp10(float3 v);
4529 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4530 extern float4 __attribute__((const, overloadable))
4531 native_exp10(float4 v);
4534 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4535 extern half __attribute__((const, overloadable))
4536 native_exp10(half v);
4539 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4540 extern half2 __attribute__((const, overloadable))
4541 native_exp10(half2 v);
4544 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4545 extern half3 __attribute__((const, overloadable))
4546 native_exp10(half3 v);
4549 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4550 extern half4 __attribute__((const, overloadable))
4551 native_exp10(half4 v);
4555 * native_exp2: Approximate 2 raised to a number
4557 * Fast approximate exp2.
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.
4564 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4565 extern float __attribute__((const, overloadable))
4566 native_exp2(float v);
4569 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4570 extern float2 __attribute__((const, overloadable))
4571 native_exp2(float2 v);
4574 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4575 extern float3 __attribute__((const, overloadable))
4576 native_exp2(float3 v);
4579 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4580 extern float4 __attribute__((const, overloadable))
4581 native_exp2(float4 v);
4584 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4585 extern half __attribute__((const, overloadable))
4586 native_exp2(half v);
4589 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4590 extern half2 __attribute__((const, overloadable))
4591 native_exp2(half2 v);
4594 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4595 extern half3 __attribute__((const, overloadable))
4596 native_exp2(half3 v);
4599 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4600 extern half4 __attribute__((const, overloadable))
4601 native_exp2(half4 v);
4605 * native_expm1: Approximate e raised to a number minus one
4607 * Returns the approximate (e ^ v) - 1.
4611 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4612 extern float __attribute__((const, overloadable))
4613 native_expm1(float v);
4616 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4617 extern float2 __attribute__((const, overloadable))
4618 native_expm1(float2 v);
4621 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4622 extern float3 __attribute__((const, overloadable))
4623 native_expm1(float3 v);
4626 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4627 extern float4 __attribute__((const, overloadable))
4628 native_expm1(float4 v);
4631 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4632 extern half __attribute__((const, overloadable))
4633 native_expm1(half v);
4636 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4637 extern half2 __attribute__((const, overloadable))
4638 native_expm1(half2 v);
4641 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4642 extern half3 __attribute__((const, overloadable))
4643 native_expm1(half3 v);
4646 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4647 extern half4 __attribute__((const, overloadable))
4648 native_expm1(half4 v);
4652 * native_hypot: Approximate hypotenuse
4654 * Returns the approximate native_sqrt(a * a + b * b)
4658 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4659 extern float __attribute__((const, overloadable))
4660 native_hypot(float a, float b);
4663 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4664 extern float2 __attribute__((const, overloadable))
4665 native_hypot(float2 a, float2 b);
4668 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4669 extern float3 __attribute__((const, overloadable))
4670 native_hypot(float3 a, float3 b);
4673 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4674 extern float4 __attribute__((const, overloadable))
4675 native_hypot(float4 a, float4 b);
4678 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4679 extern half __attribute__((const, overloadable))
4680 native_hypot(half a, half b);
4683 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4684 extern half2 __attribute__((const, overloadable))
4685 native_hypot(half2 a, half2 b);
4688 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4689 extern half3 __attribute__((const, overloadable))
4690 native_hypot(half3 a, half3 b);
4693 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4694 extern half4 __attribute__((const, overloadable))
4695 native_hypot(half4 a, half4 b);
4699 * native_log: Approximate natural logarithm
4701 * Fast approximate log.
4703 * It is not accurate for values very close to zero.
4707 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4708 extern float __attribute__((const, overloadable))
4709 native_log(float v);
4712 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4713 extern float2 __attribute__((const, overloadable))
4714 native_log(float2 v);
4717 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4718 extern float3 __attribute__((const, overloadable))
4719 native_log(float3 v);
4722 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4723 extern float4 __attribute__((const, overloadable))
4724 native_log(float4 v);
4727 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4728 extern half __attribute__((const, overloadable))
4732 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4733 extern half2 __attribute__((const, overloadable))
4734 native_log(half2 v);
4737 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4738 extern half3 __attribute__((const, overloadable))
4739 native_log(half3 v);
4742 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4743 extern half4 __attribute__((const, overloadable))
4744 native_log(half4 v);
4748 * native_log10: Approximate base 10 logarithm
4750 * Fast approximate log10.
4752 * It is not accurate for values very close to zero.
4756 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4757 extern float __attribute__((const, overloadable))
4758 native_log10(float v);
4761 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4762 extern float2 __attribute__((const, overloadable))
4763 native_log10(float2 v);
4766 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4767 extern float3 __attribute__((const, overloadable))
4768 native_log10(float3 v);
4771 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4772 extern float4 __attribute__((const, overloadable))
4773 native_log10(float4 v);
4776 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4777 extern half __attribute__((const, overloadable))
4778 native_log10(half v);
4781 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4782 extern half2 __attribute__((const, overloadable))
4783 native_log10(half2 v);
4786 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4787 extern half3 __attribute__((const, overloadable))
4788 native_log10(half3 v);
4791 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4792 extern half4 __attribute__((const, overloadable))
4793 native_log10(half4 v);
4797 * native_log1p: Approximate natural logarithm of a value plus 1
4799 * Returns the approximate natural logarithm of (v + 1.0f)
4803 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4804 extern float __attribute__((const, overloadable))
4805 native_log1p(float v);
4808 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4809 extern float2 __attribute__((const, overloadable))
4810 native_log1p(float2 v);
4813 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4814 extern float3 __attribute__((const, overloadable))
4815 native_log1p(float3 v);
4818 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4819 extern float4 __attribute__((const, overloadable))
4820 native_log1p(float4 v);
4823 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4824 extern half __attribute__((const, overloadable))
4825 native_log1p(half v);
4828 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4829 extern half2 __attribute__((const, overloadable))
4830 native_log1p(half2 v);
4833 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4834 extern half3 __attribute__((const, overloadable))
4835 native_log1p(half3 v);
4838 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4839 extern half4 __attribute__((const, overloadable))
4840 native_log1p(half4 v);
4844 * native_log2: Approximate base 2 logarithm
4846 * Fast approximate log2.
4848 * It is not accurate for values very close to zero.
4852 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4853 extern float __attribute__((const, overloadable))
4854 native_log2(float v);
4857 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4858 extern float2 __attribute__((const, overloadable))
4859 native_log2(float2 v);
4862 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4863 extern float3 __attribute__((const, overloadable))
4864 native_log2(float3 v);
4867 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4868 extern float4 __attribute__((const, overloadable))
4869 native_log2(float4 v);
4872 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4873 extern half __attribute__((const, overloadable))
4874 native_log2(half v);
4877 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4878 extern half2 __attribute__((const, overloadable))
4879 native_log2(half2 v);
4882 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4883 extern half3 __attribute__((const, overloadable))
4884 native_log2(half3 v);
4887 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4888 extern half4 __attribute__((const, overloadable))
4889 native_log2(half4 v);
4893 * native_powr: Approximate positive base raised to an exponent
4895 * Fast approximate (base ^ exponent).
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.
4903 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4904 extern float __attribute__((const, overloadable))
4905 native_powr(float base, float exponent);
4908 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4909 extern float2 __attribute__((const, overloadable))
4910 native_powr(float2 base, float2 exponent);
4913 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4914 extern float3 __attribute__((const, overloadable))
4915 native_powr(float3 base, float3 exponent);
4918 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
4919 extern float4 __attribute__((const, overloadable))
4920 native_powr(float4 base, float4 exponent);
4923 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4924 extern half __attribute__((const, overloadable))
4925 native_powr(half base, half exponent);
4928 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4929 extern half2 __attribute__((const, overloadable))
4930 native_powr(half2 base, half2 exponent);
4933 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4934 extern half3 __attribute__((const, overloadable))
4935 native_powr(half3 base, half3 exponent);
4938 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4939 extern half4 __attribute__((const, overloadable))
4940 native_powr(half4 base, half4 exponent);
4944 * native_recip: Approximate reciprocal
4946 * Returns the approximate approximate reciprocal of a value.
4948 * See also half_recip().
4950 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4951 extern float __attribute__((const, overloadable))
4952 native_recip(float v);
4955 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4956 extern float2 __attribute__((const, overloadable))
4957 native_recip(float2 v);
4960 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4961 extern float3 __attribute__((const, overloadable))
4962 native_recip(float3 v);
4965 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4966 extern float4 __attribute__((const, overloadable))
4967 native_recip(float4 v);
4970 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4971 extern half __attribute__((const, overloadable))
4972 native_recip(half v);
4975 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4976 extern half2 __attribute__((const, overloadable))
4977 native_recip(half2 v);
4980 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4981 extern half3 __attribute__((const, overloadable))
4982 native_recip(half3 v);
4985 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
4986 extern half4 __attribute__((const, overloadable))
4987 native_recip(half4 v);
4991 * native_rootn: Approximate nth root
4993 * Compute the approximate Nth root of a value.
4997 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
4998 extern float __attribute__((const, overloadable))
4999 native_rootn(float v, int n);
5002 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5003 extern float2 __attribute__((const, overloadable))
5004 native_rootn(float2 v, int2 n);
5007 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5008 extern float3 __attribute__((const, overloadable))
5009 native_rootn(float3 v, int3 n);
5012 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5013 extern float4 __attribute__((const, overloadable))
5014 native_rootn(float4 v, int4 n);
5017 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5018 extern half __attribute__((const, overloadable))
5019 native_rootn(half v, int n);
5022 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5023 extern half2 __attribute__((const, overloadable))
5024 native_rootn(half2 v, int2 n);
5027 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5028 extern half3 __attribute__((const, overloadable))
5029 native_rootn(half3 v, int3 n);
5032 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5033 extern half4 __attribute__((const, overloadable))
5034 native_rootn(half4 v, int4 n);
5038 * native_rsqrt: Approximate reciprocal of a square root
5040 * Returns approximate (1 / sqrt(v)).
5042 * See also rsqrt(), half_rsqrt().
5044 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5045 extern float __attribute__((const, overloadable))
5046 native_rsqrt(float v);
5049 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5050 extern float2 __attribute__((const, overloadable))
5051 native_rsqrt(float2 v);
5054 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5055 extern float3 __attribute__((const, overloadable))
5056 native_rsqrt(float3 v);
5059 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5060 extern float4 __attribute__((const, overloadable))
5061 native_rsqrt(float4 v);
5064 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5065 extern half __attribute__((const, overloadable))
5066 native_rsqrt(half v);
5069 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5070 extern half2 __attribute__((const, overloadable))
5071 native_rsqrt(half2 v);
5074 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5075 extern half3 __attribute__((const, overloadable))
5076 native_rsqrt(half3 v);
5079 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5080 extern half4 __attribute__((const, overloadable))
5081 native_rsqrt(half4 v);
5085 * native_sin: Approximate sine
5087 * Returns the approximate sine of an angle measured in radians.
5091 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5092 extern float __attribute__((const, overloadable))
5093 native_sin(float v);
5096 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5097 extern float2 __attribute__((const, overloadable))
5098 native_sin(float2 v);
5101 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5102 extern float3 __attribute__((const, overloadable))
5103 native_sin(float3 v);
5106 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5107 extern float4 __attribute__((const, overloadable))
5108 native_sin(float4 v);
5111 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5112 extern half __attribute__((const, overloadable))
5116 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5117 extern half2 __attribute__((const, overloadable))
5118 native_sin(half2 v);
5121 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5122 extern half3 __attribute__((const, overloadable))
5123 native_sin(half3 v);
5126 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5127 extern half4 __attribute__((const, overloadable))
5128 native_sin(half4 v);
5132 * native_sincos: Approximate sine and cosine
5134 * Returns the approximate sine and cosine of a value.
5136 * See also sincos().
5139 * v: Incoming value in radians.
5140 * cos: *cos will be set to the cosine value.
5144 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5145 extern float __attribute__((overloadable))
5146 native_sincos(float v, float* cos);
5149 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5150 extern float2 __attribute__((overloadable))
5151 native_sincos(float2 v, float2* cos);
5154 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5155 extern float3 __attribute__((overloadable))
5156 native_sincos(float3 v, float3* cos);
5159 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5160 extern float4 __attribute__((overloadable))
5161 native_sincos(float4 v, float4* cos);
5164 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5165 extern half __attribute__((overloadable))
5166 native_sincos(half v, half* cos);
5169 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5170 extern half2 __attribute__((overloadable))
5171 native_sincos(half2 v, half2* cos);
5174 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5175 extern half3 __attribute__((overloadable))
5176 native_sincos(half3 v, half3* cos);
5179 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5180 extern half4 __attribute__((overloadable))
5181 native_sincos(half4 v, half4* cos);
5185 * native_sinh: Approximate hyperbolic sine
5187 * Returns the approximate hyperbolic sine of a value specified in radians.
5191 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5192 extern float __attribute__((const, overloadable))
5193 native_sinh(float v);
5196 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5197 extern float2 __attribute__((const, overloadable))
5198 native_sinh(float2 v);
5201 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5202 extern float3 __attribute__((const, overloadable))
5203 native_sinh(float3 v);
5206 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5207 extern float4 __attribute__((const, overloadable))
5208 native_sinh(float4 v);
5211 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5212 extern half __attribute__((const, overloadable))
5213 native_sinh(half v);
5216 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5217 extern half2 __attribute__((const, overloadable))
5218 native_sinh(half2 v);
5221 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5222 extern half3 __attribute__((const, overloadable))
5223 native_sinh(half3 v);
5226 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5227 extern half4 __attribute__((const, overloadable))
5228 native_sinh(half4 v);
5232 * native_sinpi: Approximate sine of a number multiplied by pi
5234 * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
5236 * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
5240 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5241 extern float __attribute__((const, overloadable))
5242 native_sinpi(float v);
5245 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5246 extern float2 __attribute__((const, overloadable))
5247 native_sinpi(float2 v);
5250 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5251 extern float3 __attribute__((const, overloadable))
5252 native_sinpi(float3 v);
5255 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5256 extern float4 __attribute__((const, overloadable))
5257 native_sinpi(float4 v);
5260 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5261 extern half __attribute__((const, overloadable))
5262 native_sinpi(half v);
5265 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5266 extern half2 __attribute__((const, overloadable))
5267 native_sinpi(half2 v);
5270 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5271 extern half3 __attribute__((const, overloadable))
5272 native_sinpi(half3 v);
5275 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5276 extern half4 __attribute__((const, overloadable))
5277 native_sinpi(half4 v);
5281 * native_sqrt: Approximate square root
5283 * Returns the approximate sqrt(v).
5285 * See also sqrt(), half_sqrt().
5287 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5288 extern float __attribute__((const, overloadable))
5289 native_sqrt(float v);
5292 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5293 extern float2 __attribute__((const, overloadable))
5294 native_sqrt(float2 v);
5297 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5298 extern float3 __attribute__((const, overloadable))
5299 native_sqrt(float3 v);
5302 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5303 extern float4 __attribute__((const, overloadable))
5304 native_sqrt(float4 v);
5307 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5308 extern half __attribute__((const, overloadable))
5309 native_sqrt(half v);
5312 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5313 extern half2 __attribute__((const, overloadable))
5314 native_sqrt(half2 v);
5317 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5318 extern half3 __attribute__((const, overloadable))
5319 native_sqrt(half3 v);
5322 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5323 extern half4 __attribute__((const, overloadable))
5324 native_sqrt(half4 v);
5328 * native_tan: Approximate tangent
5330 * Returns the approximate tangent of an angle measured in radians.
5332 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5333 extern float __attribute__((const, overloadable))
5334 native_tan(float v);
5337 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5338 extern float2 __attribute__((const, overloadable))
5339 native_tan(float2 v);
5342 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5343 extern float3 __attribute__((const, overloadable))
5344 native_tan(float3 v);
5347 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5348 extern float4 __attribute__((const, overloadable))
5349 native_tan(float4 v);
5352 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5353 extern half __attribute__((const, overloadable))
5357 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5358 extern half2 __attribute__((const, overloadable))
5359 native_tan(half2 v);
5362 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5363 extern half3 __attribute__((const, overloadable))
5364 native_tan(half3 v);
5367 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5368 extern half4 __attribute__((const, overloadable))
5369 native_tan(half4 v);
5373 * native_tanh: Approximate hyperbolic tangent
5375 * Returns the approximate hyperbolic tangent of a value.
5379 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5380 extern float __attribute__((const, overloadable))
5381 native_tanh(float v);
5384 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5385 extern float2 __attribute__((const, overloadable))
5386 native_tanh(float2 v);
5389 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5390 extern float3 __attribute__((const, overloadable))
5391 native_tanh(float3 v);
5394 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5395 extern float4 __attribute__((const, overloadable))
5396 native_tanh(float4 v);
5399 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5400 extern half __attribute__((const, overloadable))
5401 native_tanh(half v);
5404 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5405 extern half2 __attribute__((const, overloadable))
5406 native_tanh(half2 v);
5409 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5410 extern half3 __attribute__((const, overloadable))
5411 native_tanh(half3 v);
5414 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5415 extern half4 __attribute__((const, overloadable))
5416 native_tanh(half4 v);
5420 * native_tanpi: Approximate tangent of a number multiplied by pi
5422 * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
5424 * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
5428 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5429 extern float __attribute__((const, overloadable))
5430 native_tanpi(float v);
5433 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5434 extern float2 __attribute__((const, overloadable))
5435 native_tanpi(float2 v);
5438 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5439 extern float3 __attribute__((const, overloadable))
5440 native_tanpi(float3 v);
5443 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
5444 extern float4 __attribute__((const, overloadable))
5445 native_tanpi(float4 v);
5448 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5449 extern half __attribute__((const, overloadable))
5450 native_tanpi(half v);
5453 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5454 extern half2 __attribute__((const, overloadable))
5455 native_tanpi(half2 v);
5458 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5459 extern half3 __attribute__((const, overloadable))
5460 native_tanpi(half3 v);
5463 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5464 extern half4 __attribute__((const, overloadable))
5465 native_tanpi(half4 v);
5469 * nextafter: Next floating point number
5471 * Returns the next representable floating point number from v towards target.
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.
5476 extern float __attribute__((const, overloadable))
5477 nextafter(float v, float target);
5479 extern float2 __attribute__((const, overloadable))
5480 nextafter(float2 v, float2 target);
5482 extern float3 __attribute__((const, overloadable))
5483 nextafter(float3 v, float3 target);
5485 extern float4 __attribute__((const, overloadable))
5486 nextafter(float4 v, float4 target);
5488 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5489 extern half __attribute__((const, overloadable))
5490 nextafter(half v, half target);
5493 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5494 extern half2 __attribute__((const, overloadable))
5495 nextafter(half2 v, half2 target);
5498 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5499 extern half3 __attribute__((const, overloadable))
5500 nextafter(half3 v, half3 target);
5503 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5504 extern half4 __attribute__((const, overloadable))
5505 nextafter(half4 v, half4 target);
5509 * pow: Base raised to an exponent
5511 * Returns base raised to the power exponent, i.e. base ^ exponent.
5513 * pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the
5514 * base to be non-negative.
5516 extern float __attribute__((const, overloadable))
5517 pow(float base, float exponent);
5519 extern float2 __attribute__((const, overloadable))
5520 pow(float2 base, float2 exponent);
5522 extern float3 __attribute__((const, overloadable))
5523 pow(float3 base, float3 exponent);
5525 extern float4 __attribute__((const, overloadable))
5526 pow(float4 base, float4 exponent);
5528 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5529 extern half __attribute__((const, overloadable))
5530 pow(half base, half exponent);
5533 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5534 extern half2 __attribute__((const, overloadable))
5535 pow(half2 base, half2 exponent);
5538 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5539 extern half3 __attribute__((const, overloadable))
5540 pow(half3 base, half3 exponent);
5543 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5544 extern half4 __attribute__((const, overloadable))
5545 pow(half4 base, half4 exponent);
5549 * pown: Base raised to an integer exponent
5551 * Returns base raised to the power exponent, i.e. base ^ exponent.
5553 * pow() and powr() are similar. The both take a float exponent. powr() also assumes the
5554 * base to be non-negative.
5556 extern float __attribute__((const, overloadable))
5557 pown(float base, int exponent);
5559 extern float2 __attribute__((const, overloadable))
5560 pown(float2 base, int2 exponent);
5562 extern float3 __attribute__((const, overloadable))
5563 pown(float3 base, int3 exponent);
5565 extern float4 __attribute__((const, overloadable))
5566 pown(float4 base, int4 exponent);
5568 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5569 extern half __attribute__((const, overloadable))
5570 pown(half base, int exponent);
5573 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5574 extern half2 __attribute__((const, overloadable))
5575 pown(half2 base, int2 exponent);
5578 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5579 extern half3 __attribute__((const, overloadable))
5580 pown(half3 base, int3 exponent);
5583 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5584 extern half4 __attribute__((const, overloadable))
5585 pown(half4 base, int4 exponent);
5589 * powr: Positive base raised to an exponent
5591 * Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0.
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.
5596 * See also native_powr().
5598 extern float __attribute__((const, overloadable))
5599 powr(float base, float exponent);
5601 extern float2 __attribute__((const, overloadable))
5602 powr(float2 base, float2 exponent);
5604 extern float3 __attribute__((const, overloadable))
5605 powr(float3 base, float3 exponent);
5607 extern float4 __attribute__((const, overloadable))
5608 powr(float4 base, float4 exponent);
5610 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5611 extern half __attribute__((const, overloadable))
5612 powr(half base, half exponent);
5615 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5616 extern half2 __attribute__((const, overloadable))
5617 powr(half2 base, half2 exponent);
5620 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5621 extern half3 __attribute__((const, overloadable))
5622 powr(half3 base, half3 exponent);
5625 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5626 extern half4 __attribute__((const, overloadable))
5627 powr(half4 base, half4 exponent);
5631 * radians: Converts degrees into radians
5633 * Converts from degrees to radians.
5635 extern float __attribute__((const, overloadable))
5638 extern float2 __attribute__((const, overloadable))
5641 extern float3 __attribute__((const, overloadable))
5644 extern float4 __attribute__((const, overloadable))
5647 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5648 extern half __attribute__((const, overloadable))
5652 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5653 extern half2 __attribute__((const, overloadable))
5657 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5658 extern half3 __attribute__((const, overloadable))
5662 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5663 extern half4 __attribute__((const, overloadable))
5668 * remainder: Remainder of a division
5670 * Returns the remainder of (numerator / denominator), where the quotient is rounded towards
5671 * the nearest integer.
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).
5677 extern float __attribute__((const, overloadable))
5678 remainder(float numerator, float denominator);
5680 extern float2 __attribute__((const, overloadable))
5681 remainder(float2 numerator, float2 denominator);
5683 extern float3 __attribute__((const, overloadable))
5684 remainder(float3 numerator, float3 denominator);
5686 extern float4 __attribute__((const, overloadable))
5687 remainder(float4 numerator, float4 denominator);
5689 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5690 extern half __attribute__((const, overloadable))
5691 remainder(half numerator, half denominator);
5694 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5695 extern half2 __attribute__((const, overloadable))
5696 remainder(half2 numerator, half2 denominator);
5699 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5700 extern half3 __attribute__((const, overloadable))
5701 remainder(half3 numerator, half3 denominator);
5704 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5705 extern half4 __attribute__((const, overloadable))
5706 remainder(half4 numerator, half4 denominator);
5710 * remquo: Remainder and quotient of a division
5712 * Returns the quotient and the remainder of (numerator / denominator).
5714 * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
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.
5721 * Example: remquo(-23.5f, 8.f, ") sets the lowest three bits of quot to 3
5722 * and the sign negative. It returns 0.5f.
5725 * numerator: Numerator.
5726 * denominator: Denominator.
5727 * quotient: *quotient will be set to the integer quotient.
5729 * Returns: Remainder, precise only for the low three bits.
5731 extern float __attribute__((overloadable))
5732 remquo(float numerator, float denominator, int* quotient);
5734 extern float2 __attribute__((overloadable))
5735 remquo(float2 numerator, float2 denominator, int2* quotient);
5737 extern float3 __attribute__((overloadable))
5738 remquo(float3 numerator, float3 denominator, int3* quotient);
5740 extern float4 __attribute__((overloadable))
5741 remquo(float4 numerator, float4 denominator, int4* quotient);
5743 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5744 extern half __attribute__((overloadable))
5745 remquo(half numerator, half denominator, int* quotient);
5748 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5749 extern half2 __attribute__((overloadable))
5750 remquo(half2 numerator, half2 denominator, int2* quotient);
5753 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5754 extern half3 __attribute__((overloadable))
5755 remquo(half3 numerator, half3 denominator, int3* quotient);
5758 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5759 extern half4 __attribute__((overloadable))
5760 remquo(half4 numerator, half4 denominator, int4* quotient);
5764 * rint: Round to even
5766 * Rounds to the nearest integral value.
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.
5772 * round() is similar but rounds away from zero. trunc() truncates the decimal fraction.
5774 extern float __attribute__((const, overloadable))
5777 extern float2 __attribute__((const, overloadable))
5780 extern float3 __attribute__((const, overloadable))
5783 extern float4 __attribute__((const, overloadable))
5786 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5787 extern half __attribute__((const, overloadable))
5791 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5792 extern half2 __attribute__((const, overloadable))
5796 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5797 extern half3 __attribute__((const, overloadable))
5801 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5802 extern half4 __attribute__((const, overloadable))
5809 * Compute the Nth root of a value.
5811 * See also native_rootn().
5813 extern float __attribute__((const, overloadable))
5814 rootn(float v, int n);
5816 extern float2 __attribute__((const, overloadable))
5817 rootn(float2 v, int2 n);
5819 extern float3 __attribute__((const, overloadable))
5820 rootn(float3 v, int3 n);
5822 extern float4 __attribute__((const, overloadable))
5823 rootn(float4 v, int4 n);
5825 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5826 extern half __attribute__((const, overloadable))
5827 rootn(half v, int n);
5830 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5831 extern half2 __attribute__((const, overloadable))
5832 rootn(half2 v, int2 n);
5835 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5836 extern half3 __attribute__((const, overloadable))
5837 rootn(half3 v, int3 n);
5840 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5841 extern half4 __attribute__((const, overloadable))
5842 rootn(half4 v, int4 n);
5846 * round: Round away from zero
5848 * Round to the nearest integral value.
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.
5854 * rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction.
5856 extern float __attribute__((const, overloadable))
5859 extern float2 __attribute__((const, overloadable))
5862 extern float3 __attribute__((const, overloadable))
5865 extern float4 __attribute__((const, overloadable))
5868 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5869 extern half __attribute__((const, overloadable))
5873 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5874 extern half2 __attribute__((const, overloadable))
5878 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5879 extern half3 __attribute__((const, overloadable))
5883 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5884 extern half4 __attribute__((const, overloadable))
5889 * rsqrt: Reciprocal of a square root
5891 * Returns (1 / sqrt(v)).
5893 * See also half_rsqrt(), native_rsqrt().
5895 extern float __attribute__((const, overloadable))
5898 extern float2 __attribute__((const, overloadable))
5901 extern float3 __attribute__((const, overloadable))
5904 extern float4 __attribute__((const, overloadable))
5907 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5908 extern half __attribute__((const, overloadable))
5912 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5913 extern half2 __attribute__((const, overloadable))
5917 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5918 extern half3 __attribute__((const, overloadable))
5922 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5923 extern half4 __attribute__((const, overloadable))
5928 * sign: Sign of a value
5930 * Returns the sign of a value.
5932 * if (v < 0) return -1.f;
5933 * else if (v > 0) return 1.f;
5936 extern float __attribute__((const, overloadable))
5939 extern float2 __attribute__((const, overloadable))
5942 extern float3 __attribute__((const, overloadable))
5945 extern float4 __attribute__((const, overloadable))
5948 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5949 extern half __attribute__((const, overloadable))
5953 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5954 extern half2 __attribute__((const, overloadable))
5958 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5959 extern half3 __attribute__((const, overloadable))
5963 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5964 extern half4 __attribute__((const, overloadable))
5971 * Returns the sine of an angle measured in radians.
5973 * See also native_sin().
5975 extern float __attribute__((const, overloadable))
5978 extern float2 __attribute__((const, overloadable))
5981 extern float3 __attribute__((const, overloadable))
5984 extern float4 __attribute__((const, overloadable))
5987 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5988 extern half __attribute__((const, overloadable))
5992 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5993 extern half2 __attribute__((const, overloadable))
5997 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
5998 extern half3 __attribute__((const, overloadable))
6002 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6003 extern half4 __attribute__((const, overloadable))
6008 * sincos: Sine and cosine
6010 * Returns the sine and cosine of a value.
6012 * See also native_sincos().
6015 * v: Incoming value in radians.
6016 * cos: *cos will be set to the cosine value.
6018 * Returns: Sine of v.
6020 extern float __attribute__((overloadable))
6021 sincos(float v, float* cos);
6023 extern float2 __attribute__((overloadable))
6024 sincos(float2 v, float2* cos);
6026 extern float3 __attribute__((overloadable))
6027 sincos(float3 v, float3* cos);
6029 extern float4 __attribute__((overloadable))
6030 sincos(float4 v, float4* cos);
6032 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6033 extern half __attribute__((overloadable))
6034 sincos(half v, half* cos);
6037 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6038 extern half2 __attribute__((overloadable))
6039 sincos(half2 v, half2* cos);
6042 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6043 extern half3 __attribute__((overloadable))
6044 sincos(half3 v, half3* cos);
6047 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6048 extern half4 __attribute__((overloadable))
6049 sincos(half4 v, half4* cos);
6053 * sinh: Hyperbolic sine
6055 * Returns the hyperbolic sine of v, where v is measured in radians.
6057 * See also native_sinh().
6059 extern float __attribute__((const, overloadable))
6062 extern float2 __attribute__((const, overloadable))
6065 extern float3 __attribute__((const, overloadable))
6068 extern float4 __attribute__((const, overloadable))
6071 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6072 extern half __attribute__((const, overloadable))
6076 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6077 extern half2 __attribute__((const, overloadable))
6081 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6082 extern half3 __attribute__((const, overloadable))
6086 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6087 extern half4 __attribute__((const, overloadable))
6092 * sinpi: Sine of a number multiplied by pi
6094 * Returns the sine of (v * pi), where (v * pi) is measured in radians.
6096 * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
6098 * See also native_sinpi().
6100 extern float __attribute__((const, overloadable))
6103 extern float2 __attribute__((const, overloadable))
6106 extern float3 __attribute__((const, overloadable))
6109 extern float4 __attribute__((const, overloadable))
6112 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6113 extern half __attribute__((const, overloadable))
6117 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6118 extern half2 __attribute__((const, overloadable))
6122 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6123 extern half3 __attribute__((const, overloadable))
6127 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6128 extern half4 __attribute__((const, overloadable))
6135 * Returns the square root of a value.
6137 * See also half_sqrt(), native_sqrt().
6139 extern float __attribute__((const, overloadable))
6142 extern float2 __attribute__((const, overloadable))
6145 extern float3 __attribute__((const, overloadable))
6148 extern float4 __attribute__((const, overloadable))
6151 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6152 extern half __attribute__((const, overloadable))
6156 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6157 extern half2 __attribute__((const, overloadable))
6161 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6162 extern half3 __attribute__((const, overloadable))
6166 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6167 extern half4 __attribute__((const, overloadable))
6172 * step: 0 if less than a value, 0 otherwise
6174 * Returns 0.f if v < edge, 1.f otherwise.
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).
6180 extern float __attribute__((const, overloadable))
6181 step(float edge, float v);
6183 extern float2 __attribute__((const, overloadable))
6184 step(float2 edge, float2 v);
6186 extern float3 __attribute__((const, overloadable))
6187 step(float3 edge, float3 v);
6189 extern float4 __attribute__((const, overloadable))
6190 step(float4 edge, float4 v);
6192 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6193 extern half __attribute__((const, overloadable))
6194 step(half edge, half v);
6197 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6198 extern half2 __attribute__((const, overloadable))
6199 step(half2 edge, half2 v);
6202 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6203 extern half3 __attribute__((const, overloadable))
6204 step(half3 edge, half3 v);
6207 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6208 extern half4 __attribute__((const, overloadable))
6209 step(half4 edge, half4 v);
6212 extern float2 __attribute__((const, overloadable))
6213 step(float2 edge, float v);
6215 extern float3 __attribute__((const, overloadable))
6216 step(float3 edge, float v);
6218 extern float4 __attribute__((const, overloadable))
6219 step(float4 edge, float v);
6221 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6222 extern half2 __attribute__((const, overloadable))
6223 step(half2 edge, half v);
6226 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6227 extern half3 __attribute__((const, overloadable))
6228 step(half3 edge, half v);
6231 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6232 extern half4 __attribute__((const, overloadable))
6233 step(half4 edge, half v);
6236 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
6237 extern float2 __attribute__((const, overloadable))
6238 step(float edge, float2 v);
6241 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
6242 extern float3 __attribute__((const, overloadable))
6243 step(float edge, float3 v);
6246 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
6247 extern float4 __attribute__((const, overloadable))
6248 step(float edge, float4 v);
6251 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6252 extern half2 __attribute__((const, overloadable))
6253 step(half edge, half2 v);
6256 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6257 extern half3 __attribute__((const, overloadable))
6258 step(half edge, half3 v);
6261 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6262 extern half4 __attribute__((const, overloadable))
6263 step(half edge, half4 v);
6269 * Returns the tangent of an angle measured in radians.
6271 * See also native_tan().
6273 extern float __attribute__((const, overloadable))
6276 extern float2 __attribute__((const, overloadable))
6279 extern float3 __attribute__((const, overloadable))
6282 extern float4 __attribute__((const, overloadable))
6285 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6286 extern half __attribute__((const, overloadable))
6290 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6291 extern half2 __attribute__((const, overloadable))
6295 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6296 extern half3 __attribute__((const, overloadable))
6300 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6301 extern half4 __attribute__((const, overloadable))
6306 * tanh: Hyperbolic tangent
6308 * Returns the hyperbolic tangent of a value.
6310 * See also native_tanh().
6312 extern float __attribute__((const, overloadable))
6315 extern float2 __attribute__((const, overloadable))
6318 extern float3 __attribute__((const, overloadable))
6321 extern float4 __attribute__((const, overloadable))
6324 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6325 extern half __attribute__((const, overloadable))
6329 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6330 extern half2 __attribute__((const, overloadable))
6334 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6335 extern half3 __attribute__((const, overloadable))
6339 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6340 extern half4 __attribute__((const, overloadable))
6345 * tanpi: Tangent of a number multiplied by pi
6347 * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
6349 * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
6351 * See also native_tanpi().
6353 extern float __attribute__((const, overloadable))
6356 extern float2 __attribute__((const, overloadable))
6359 extern float3 __attribute__((const, overloadable))
6362 extern float4 __attribute__((const, overloadable))
6365 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6366 extern half __attribute__((const, overloadable))
6370 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6371 extern half2 __attribute__((const, overloadable))
6375 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6376 extern half3 __attribute__((const, overloadable))
6380 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6381 extern half4 __attribute__((const, overloadable))
6386 * tgamma: Gamma function
6388 * Returns the gamma function of a value.
6390 * See also lgamma().
6392 extern float __attribute__((const, overloadable))
6395 extern float2 __attribute__((const, overloadable))
6398 extern float3 __attribute__((const, overloadable))
6401 extern float4 __attribute__((const, overloadable))
6404 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6405 extern half __attribute__((const, overloadable))
6409 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6410 extern half2 __attribute__((const, overloadable))
6414 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6415 extern half3 __attribute__((const, overloadable))
6419 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6420 extern half4 __attribute__((const, overloadable))
6425 * trunc: Truncates a floating point
6427 * Rounds to integral using truncation.
6429 * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
6431 * See rint() and round() for other rounding options.
6433 extern float __attribute__((const, overloadable))
6436 extern float2 __attribute__((const, overloadable))
6439 extern float3 __attribute__((const, overloadable))
6442 extern float4 __attribute__((const, overloadable))
6445 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6446 extern half __attribute__((const, overloadable))
6450 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6451 extern half2 __attribute__((const, overloadable))
6455 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6456 extern half3 __attribute__((const, overloadable))
6460 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
6461 extern half4 __attribute__((const, overloadable))
6466 * rsClamp: Restrain a value to a range
6468 * DEPRECATED. Do not use.
6470 * Clamp a value between low and high.
6473 * amount: Value to clamp.
6475 * high: Upper bound.
6477 extern char __attribute__((const, overloadable
6478 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6479 , deprecated("Use clamp() instead.")
6482 rsClamp(char amount, char low, char high);
6484 extern uchar __attribute__((const, overloadable
6485 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6486 , deprecated("Use clamp() instead.")
6489 rsClamp(uchar amount, uchar low, uchar high);
6491 extern short __attribute__((const, overloadable
6492 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6493 , deprecated("Use clamp() instead.")
6496 rsClamp(short amount, short low, short high);
6498 extern ushort __attribute__((const, overloadable
6499 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6500 , deprecated("Use clamp() instead.")
6503 rsClamp(ushort amount, ushort low, ushort high);
6505 extern int __attribute__((const, overloadable
6506 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6507 , deprecated("Use clamp() instead.")
6510 rsClamp(int amount, int low, int high);
6512 extern uint __attribute__((const, overloadable
6513 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6514 , deprecated("Use clamp() instead.")
6517 rsClamp(uint amount, uint low, uint high);
6520 * rsFrac: Returns the fractional part of a float
6522 * DEPRECATED. Do not use.
6524 * Returns the fractional part of a float
6526 extern float __attribute__((const, overloadable
6527 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
6528 , deprecated("Use fract() instead.")
6534 * rsRand: Pseudo-random number
6536 * Return a random value between 0 (or min_value) and max_malue.
6538 extern int __attribute__((overloadable))
6539 rsRand(int max_value);
6541 extern int __attribute__((overloadable))
6542 rsRand(int min_value, int max_value);
6544 extern float __attribute__((overloadable))
6545 rsRand(float max_value);
6547 extern float __attribute__((overloadable))
6548 rsRand(float min_value, float max_value);
6550 #endif // RENDERSCRIPT_RS_MATH_RSH