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