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