Zen API
 All Classes Files Functions Variables Typedefs Macros Groups Pages
kMath.h
Go to the documentation of this file.
1 /**
2  * @file kMath.h
3  * @brief Math-related utilities.
4  *
5  * @internal
6  * Copyright (C) 2005-2014 by LMI Technologies Inc.
7  * Licensed under the MIT License.
8  * Redistributed files must retain the above copyright notice.
9  */
10 #ifndef K_API_MATH_H
11 #define K_API_MATH_H
12 
13 #include <kApi/kApiDef.h>
14 
15 kBeginHeader()
16 
17 #define kMATH_PI (3.1415926535897932384626433832795) ///< Mathematical constant pi.
18 #define kMATH_E (2.7182818284590452353602874713527) ///< Mathematical constant e.
19 #define kMATH_SQRT2 (1.4142135623730950488016887242097) ///< Square root of 2.
20 #define kMATH_SQRT3 (1.7320508075688772935274463415059) ///< Square root of 3.
21 
22 #define kMath_RadToDeg_(RAD) kxMath_RadToDeg_(RAD) ///< Converts radians to degrees.
23 #define kMath_DegToRad_(DEG) kxMath_DegToRad_(DEG) ///< Converts degrees to radians.
24 #define kMath_Abs_(A) kxMath_Abs_(A) ///< Returns the absolute value of a number.
25 #define kMath_Min_(A, B) kxMath_Min_((A), (B)) ///< Returns the minimum of two numbers.
26 #define kMath_Max_(A, B) kxMath_Max_((A), (B)) ///< Returns the maximum of two numbers.
27 #define kMath_Sign_(A) kxMath_Sign_(A) ///< Returns the sign of a number (-1, 0, +1).
28 #define kMath_Common_Residue_(A,B) kxMath_Common_Residue_((A), (B)) ///< Returns the common residue of A and B.
29 #define kMath_Clamp_(V, VMIN, VMAX) kxMath_Clamp_((V), (VMIN), (VMAX)) ///< Returns a value limited to the given range.
30 #define kMath_Round8s_(A) kxMath_Round8s_(A) ///< Rounds a floating-point value and casts to an 8-bit signed integer.
31 #define kMath_Round8u_(A) kxMath_Round8u_(A) ///< Rounds a floating-point value and casts to an 8-bit unsigned integer.
32 #define kMath_Round16s_(A) kxMath_Round16s_(A) ///< Rounds a floating-point value and casts to an 16-bit signed integer.
33 #define kMath_Round16u_(A) kxMath_Round16u_(A) ///< Rounds a floating-point value and casts to an 16-bit unsigned integer.
34 #define kMath_Round32s_(A) kxMath_Round32s_(A) ///< Rounds a floating-point value and casts to an 32-bit signed integer.
35 #define kMath_Round32u_(A) kxMath_Round32u_(A) ///< Rounds a floating-point value and casts to an 32-bit unsigned integer.
36 #define kMath_Round64s_(A) kxMath_Round64s_(A) ///< Rounds a floating-point value and casts to an 64-bit signed integer.
37 #define kMath_Round64u_(A) kxMath_Round64u_(A) ///< Rounds a floating-point value and casts to an 64-bit unsigned integer.
38 
39 /**
40  * Compares each value in a numerical array with a specified value and returns the index of the first match.
41  *
42  * @public @memberof kMath
43  * @param v Array of values.
44  * @param count Count of values.
45  * @param comparison Comparator that will be used to determine a match.
46  * @param value Value for comparison.
47  * @param index Returns the index of the first match (or count, if no match is found).
48  * @return Operation status.
49  */
50 kFx(kStatus) kMath_FindFirst32s(const k32s* v, kSize count, kComparison comparison, k32s value, kSize* index);
51 
52 /**
53  * Compares each value in a numerical array with a specified value and returns the index of the first match.
54  *
55  * @public @memberof kMath
56  * @param v Array of values.
57  * @param count Count of values.
58  * @param comparison Comparator used to determine a match.
59  * @param value Value for comparison.
60  * @param index Returns the index of the first match (or count, if no match is found).
61  * @return Operation status.
62  */
63 kFx(kStatus) kMath_FindFirst64f(const k64f* v, kSize count, kComparison comparison, k64f value, kSize* index);
64 
65 /**
66  * Compares each value in a numerical array with a specified value and returns the index of the last match.
67  *
68  * @public @memberof kMath
69  * @param v Array of values.
70  * @param count Count of values.
71  * @param comparison Comparator used to determine a match.
72  * @param value Value for comparison.
73  * @param index Returns the index of the last match (or count, if no match is found).
74  * @return Operation status.
75  */
76 kFx(kStatus) kMath_FindLast32s(const k32s* v, kSize count, kComparison comparison, k32s value, kSize* index);
77 
78 /**
79  * Compares each value in a numerical array with a specified value and returns the index of the last match.
80  *
81  * @public @memberof kMath
82  * @param v Array of values.
83  * @param count Count of values.
84  * @param comparison Comparator that will be used to determine a match.
85  * @param value Value for comparison.
86  * @param index Returns the index of the last match (or count, if no match is found).
87  * @return Operation status.
88  */
89 kFx(kStatus) kMath_FindLast64f(const k64f* v, kSize count, kComparison comparison, k64f value, kSize* index);
90 
91 /**
92  * Finds the index of the minimum value within a numerical array.
93  *
94  * @public @memberof kMath
95  * @param v Array of values.
96  * @param count Count of values.
97  * @param index Returns the index of the minimum value.
98  * @return Operation status.
99  */
100 kFx(kStatus) kMath_FindMin32s(const k32s* v, kSize count, kSize* index);
101 
102 /**
103  * Finds the index of the minimum value within a numerical array.
104  *
105  * @public @memberof kMath
106  * @param v Array of values.
107  * @param count Count of values.
108  * @param index Returns the index of the minimum value.
109  * @return Operation status.
110  */
111 kFx(kStatus) kMath_FindMin64f(const k64f* v, kSize count, kSize* index);
112 
113 /**
114  * Finds the index of the maximum value within a numerical array.
115  *
116  * @public @memberof kMath
117  * @param v Array of values.
118  * @param count Count of values.
119  * @param index Returns the index of the maximum value.
120  * @return Operation status.
121  */
122 kFx(kStatus) kMath_FindMax32s(const k32s* v, kSize count, kSize* index);
123 
124 /**
125  * Finds the index of the maximum value within a numerical array.
126  *
127  * @public @memberof kMath
128  * @param v Array of values.
129  * @param count Count of values.
130  * @param index Returns the index of the maximum value.
131  * @return Operation status.
132  */
133 kFx(kStatus) kMath_FindMax64f(const k64f* v, kSize count, kSize* index);
134 
135 /**
136  * Calculates the sum of a numerical array.
137  *
138  * @public @memberof kMath
139  * @param v Array of values.
140  * @param count Count of values.
141  * @param sum Returns the sum.
142  * @return Operation status.
143  */
144 kFx(kStatus) kMath_Sum32s(const k32s* v, kSize count, k64s* sum);
145 
146 /**
147  * Calculates the sum of a numerical array.
148  *
149  * @public @memberof kMath
150  * @param v Array of values.
151  * @param count Count of values.
152  * @param sum Returns the sum.
153  * @return Operation status.
154  */
155 kFx(kStatus) kMath_Sum64f(const k64f* v, kSize count, k64f* sum);
156 
157 /**
158  * Calculates the average value for a numerical array.
159  *
160  * @public @memberof kMath
161  * @param v Array of values.
162  * @param count Count of values.
163  * @param average Returns the average.
164  * @return Operation status.
165  */
166 kFx(kStatus) kMath_Average32s(const k32s* v, kSize count, k64f* average);
167 
168 /**
169  * Calculates the average value for a numerical array.
170  *
171  * @public @memberof kMath
172  * @param v Array of values.
173  * @param count Count of values.
174  * @param average Returns the average.
175  * @return Operation status.
176  */
177 kFx(kStatus) kMath_Average64f(const k64f* v, kSize count, k64f* average);
178 
179 /**
180  * Calculates the standard deviation for a numerical array.
181  *
182  * @public @memberof kMath
183  * @param v Array of values.
184  * @param count Count of values.
185  * @param stdev Returns the standard deviation.
186  * @return Operation status.
187  */
188 kFx(kStatus) kMath_Stdev32s(const k32s* v, kSize count, k64f* stdev);
189 
190 /**
191  * Calculates the standard deviation for a numerical array.
192  *
193  * @public @memberof kMath
194  * @param v Array of values.
195  * @param count Count of values.
196  * @param stdev Returns the standard deviation.
197  * @return Operation status.
198  */
199 kFx(kStatus) kMath_Stdev64f(const k64f* v, kSize count, k64f* stdev);
200 
201 /**
202  * Reports the minimum value in a numerical array.
203  *
204  * @public @memberof kMath
205  * @param v Array of values.
206  * @param count Count of values.
207  * @param minValue Returns the minimum value.
208  * @return Operation status.
209  */
210 kFx(kStatus) kMath_Min32s(const k32s* v, kSize count, k32s* minValue);
211 
212 /**
213  * Reports the minimum value in a numerical array.
214  *
215  * @public @memberof kMath
216  * @param v Array of values.
217  * @param count Count of values.
218  * @param minValue Returns the minimum value.
219  * @return Operation status.
220  */
221 kFx(kStatus) kMath_Min64f(const k64f* v, kSize count, k64f* minValue);
222 
223 /**
224  * Reports the maximum value in a numerical array.
225  *
226  * @public @memberof kMath
227  * @param v Array of values.
228  * @param count Count of values.
229  * @param maxValue Returns the maximum value.
230  * @return Operation status.
231  */
232 kFx(kStatus) kMath_Max32s(const k32s* v, kSize count, k32s* maxValue);
233 
234 /**
235  * Reports the maximum value in a numerical array.
236  *
237  * @public @memberof kMath
238  * @param v Array of values.
239  * @param count Count of values.
240  * @param maxValue Returns the maximum value.
241  * @return Operation status.
242  */
243 kFx(kStatus) kMath_Max64f(const k64f* v, kSize count, k64f* maxValue);
244 
245 /**
246  * Calculates the center of gravity for a numerical array.
247  *
248  * @public @memberof kMath
249  * @param v Array of values.
250  * @param count Count of values.
251  * @param centroid Returns the centroid.
252  * @return Operation status.
253  */
254 kFx(kStatus) kMath_Centroid32s(const k32s* v, kSize count, k64f* centroid);
255 
256 /**
257  * Calculates the center of gravity for a numerical array.
258  *
259  * @public @memberof kMath
260  * @param v Array of values.
261  * @param count Count of values.
262  * @param centroid Returns the centroid.
263  * @return Operation status.
264  */
265 kFx(kStatus) kMath_Centroid64f(const k64f* v, kSize count, k64f* centroid);
266 
267 /**
268  * Sets all values in a numerical array to the given value.
269  *
270  * @public @memberof kMath
271  * @param v Array of values.
272  * @param count Count of values.
273  * @param value Value to set.
274  * @return Operation status.
275  */
276 kFx(kStatus) kMath_Set32s(k32s* v, kSize count, k32s value);
277 
278 /**
279  * Sets all values in a numerical array to the given value.
280  *
281  * @public @memberof kMath
282  * @param v Array of values.
283  * @param count Count of values.
284  * @param value Value to set.
285  * @return Operation status.
286  */
287 kFx(kStatus) kMath_Set64f(k64f* v, kSize count, k64f value);
288 
289 /**
290  * Sets values in a numerical array to increment from the specified starting value.
291  *
292  * @public @memberof kMath
293  * @param v Array of values.
294  * @param count Count of values.
295  * @param startValue First value.
296  * @param increment Increment amount.
297  * @return Operation status.
298  */
299 kFx(kStatus) kMath_Step32s(k32s* v, kSize count, k32s startValue, k32s increment);
300 
301 /**
302  * Sets values in a numerical array to increment from the specified starting value.
303  *
304  * @public @memberof kMath
305  * @param v Array of values.
306  * @param count Count of values.
307  * @param startValue First value.
308  * @param increment Increment amount.
309  * @return Operation status.
310  */
311 kFx(kStatus) kMath_Step64f(k64f* v, kSize count, k64f startValue, k64f increment);
312 
313 /**
314  * Sets values in a numerical array to step between the specified start and end values.
315  *
316  * @public @memberof kMath
317  * @param v Array of values.
318  * @param count Count of values.
319  * @param startValue First value.
320  * @param endValue Last value.
321  * @return Operation status.
322  */
323 kFx(kStatus) kMath_Span32s(k32s* v, kSize count, k32s startValue, k32s endValue);
324 
325 /**
326  * Sets values in a numerical array to step between the specified start and end values.
327  *
328  * @public @memberof kMath
329  * @param v Array of values.
330  * @param count Count of values.
331  * @param startValue First value.
332  * @param endValue Last value.
333  * @return Operation status.
334  */
335 kFx(kStatus) kMath_Span64f(k64f* v, kSize count, k64f startValue, k64f endValue);
336 
337 /**
338  * Calculates the absolute value of each element in an input array and stores the result in an output array.
339  *
340  * @public @memberof kMath
341  * @param vIn Input array.
342  * @param vOut Output array.
343  * @param count Count of values.
344  * @return Operation status.
345  */
346 kFx(kStatus) kMath_Abs32s(const k32s* vIn, k32s* vOut, kSize count);
347 
348 /**
349  * Calculates the absolute value of each element in an input array and stores the result in an output array.
350  *
351  * @public @memberof kMath
352  * @param vIn Input array.
353  * @param vOut Output array.
354  * @param count Count of values.
355  * @return Operation status.
356  */
357 kFx(kStatus) kMath_Abs64f(const k64f* vIn, k64f* vOut, kSize count);
358 
359 /**
360  * Adds a constant to each element in an input array and stores the result in an output array.
361  *
362  * @public @memberof kMath
363  * @param vIn Input array.
364  * @param vOut Output array.
365  * @param count Count of values.
366  * @param value Constant value.
367  * @return Operation status.
368  */
369 kFx(kStatus) kMath_AddC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
370 
371 /**
372  * Adds a constant to each element in an input array and stores the result in an output array.
373  *
374  * @public @memberof kMath
375  * @param vIn Input array.
376  * @param vOut Output array.
377  * @param count Count of values.
378  * @param value Constant value.
379  * @return Operation status.
380  */
381 kFx(kStatus) kMath_AddC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
382 
383 /**
384  * Subtracts a constant from each element in an input array and stores the result in an output array.
385  *
386  * @public @memberof kMath
387  * @param vIn Input array.
388  * @param vOut Output array.
389  * @param count Count of values.
390  * @param value Constant value.
391  * @return Operation status.
392  */
393 kFx(kStatus) kMath_SubC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
394 
395 /**
396  * Subtracts a constant from each element in an input array and stores the result in an output array.
397  *
398  * @public @memberof kMath
399  * @param vIn Input array.
400  * @param vOut Output array.
401  * @param count Count of values.
402  * @param value Constant value.
403  * @return Operation status.
404  */
405 kFx(kStatus) kMath_SubC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
406 
407 /**
408  * Multiplies each element in an input array by a constant and stores the result in an output array.
409  *
410  * @public @memberof kMath
411  * @param vIn Input array.
412  * @param vOut Output array.
413  * @param count Count of values.
414  * @param value Constant value.
415  * @return Operation status.
416  */
417 kFx(kStatus) kMath_MulC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
418 
419 /**
420  * Multiplies each element in an input array by a constant and stores the result in an output array.
421  *
422  * @public @memberof kMath
423  * @param vIn Input array.
424  * @param vOut Output array.
425  * @param count Count of values.
426  * @param value Constant value.
427  * @return Operation status.
428  */
429 kFx(kStatus) kMath_MulC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
430 
431 /**
432  * Divides each element in an input array by a constant and stores the result in an output array.
433  *
434  * @public @memberof kMath
435  * @param vIn Input array.
436  * @param vOut Output array.
437  * @param count Count of values.
438  * @param value Constant value.
439  * @return Operation status.
440  */
441 kFx(kStatus) kMath_DivC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
442 
443 /**
444  * Divides each element in an input array by a constant and stores the result in an output array.
445  *
446  * @public @memberof kMath
447  * @param vIn Input array.
448  * @param vOut Output array.
449  * @param count Count of values.
450  * @param value Constant value.
451  * @return Operation status.
452  */
453 kFx(kStatus) kMath_DivC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
454 
455 /**
456  * Limits each element in an input array using a minimum and maximum value.
457  *
458  * @public @memberof kMath
459  * @param vIn Input array.
460  * @param vOut Output array.
461  * @param count Count of values.
462  * @param minValue Minimum value.
463  * @param maxValue Maximum value.
464  * @return Operation status.
465  */
466 kFx(kStatus) kMath_ClampC32s(const k32s* vIn, k32s* vOut, kSize count, k32s minValue, k32s maxValue);
467 
468 /**
469  * Limits each element in an input array using a minimum and maximum value.
470  *
471  * @public @memberof kMath
472  * @param vIn Input array.
473  * @param vOut Output array.
474  * @param count Count of values.
475  * @param minValue Minimum value.
476  * @param maxValue Maximum value.
477  * @return Operation status.
478  */
479 kFx(kStatus) kMath_ClampC64f(const k64f* vIn, k64f* vOut, kSize count, k64f minValue, k64f maxValue);
480 
481 /**
482  * Compares each element in an input array with a specified value, and replaces all matching values with another given value.
483  *
484  * @public @memberof kMath
485  * @param vIn Input array.
486  * @param vOut Output array.
487  * @param count Count of values.
488  * @param comparison Comparator used to determine a match.
489  * @param value Value for comparison.
490  * @param replacement Value for replacement.
491  * @return Operation status.
492  */
493 kFx(kStatus) kMath_ReplaceC32s(const k32s* vIn, k32s* vOut, kSize count, kComparison comparison, k32s value, k32s replacement);
494 
495 /**
496  * Compares each element in an input array with a specified value, and replaces all matching values with another given value.
497  *
498  * @public @memberof kMath
499  * @param vIn Input array.
500  * @param vOut Output array.
501  * @param count Count of values.
502  * @param comparison Comparator used to determine a match.
503  * @param value Value for comparison.
504  * @param replacement Value for replacement.
505  * @return Operation status.
506  */
507 kFx(kStatus) kMath_ReplaceC64f(const k64f* vIn, k64f* vOut, kSize count, kComparison comparison, k64f value, k64f replacement);
508 
509 /**
510  * Compares each element in an input array with a specified value and stores the results in an output array.
511  *
512  * @public @memberof kMath
513  * @param vIn Input array.
514  * @param vOut Output array.
515  * @param count Count of values.
516  * @param comparison Comparator used to determine a match.
517  * @param value Value for comparison.
518  * @return Operation status.
519  */
520 kFx(kStatus) kMath_CompareC32s(const k32s* vIn, kBool* vOut, kSize count, kComparison comparison, k32s value);
521 
522 /**
523  * Compares each element in an input array with a specified value and stores the results in an output array.
524  *
525  * @public @memberof kMath
526  * @param vIn Input array.
527  * @param vOut Output array.
528  * @param count Count of values.
529  * @param comparison Comparator used to determine a match.
530  * @param value Value for comparison.
531  * @return Operation status.
532  */
533 kFx(kStatus) kMath_CompareC64f(const k64f* vIn, kBool* vOut, kSize count, kComparison comparison, k64f value);
534 
535 /**
536  * Adds the values in two input arrays and stores the result in an output array.
537  *
538  * @public @memberof kMath
539  * @param vIn1 First input array.
540  * @param vIn2 Second input array.
541  * @param vOut Output array.
542  * @param count Count of values.
543  * @return Operation status.
544  */
545 kFx(kStatus) kMath_Add32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
546 
547 /**
548  * Adds the values in two input arrays and stores the result in an output array.
549  *
550  * @public @memberof kMath
551  * @param vIn1 First input array.
552  * @param vIn2 Second input array.
553  * @param vOut Output array.
554  * @param count Count of values.
555  * @return Operation status.
556  */
557 kFx(kStatus) kMath_Add64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
558 
559 /**
560  * Subtracts the values in two input arrays and stores the result in an output array.
561  *
562  * @public @memberof kMath
563  * @param vIn1 First input array.
564  * @param vIn2 Second input array.
565  * @param vOut Output array.
566  * @param count Count of values.
567  * @return Operation status.
568  */
569 kFx(kStatus) kMath_Sub32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
570 
571 /**
572  * Subtracts the values in two input arrays and stores the result in an output array.
573  *
574  * @public @memberof kMath
575  * @param vIn1 First input array.
576  * @param vIn2 Second input array.
577  * @param vOut Output array.
578  * @param count Count of values.
579  * @return Operation status.
580  */
581 kFx(kStatus) kMath_Sub64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
582 
583 /**
584  * Multiplies the values in two input arrays and stores the result in an output array.
585  *
586  * @public @memberof kMath
587  * @param vIn1 First input array.
588  * @param vIn2 Second input array.
589  * @param vOut Output array.
590  * @param count Count of values.
591  * @return Operation status.
592  */
593 kFx(kStatus) kMath_Mul32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
594 
595 /**
596  * Multiplies the values in two input arrays and stores the result in an output array.
597  *
598  * @public @memberof kMath
599  * @param vIn1 First input array.
600  * @param vIn2 Second input array.
601  * @param vOut Output array.
602  * @param count Count of values.
603  * @return Operation status.
604  */
605 kFx(kStatus) kMath_Mul64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
606 
607 /**
608  * Divides the values in two input arrays and stores the result in an output array.
609  *
610  * @public @memberof kMath
611  * @param vIn1 First input array.
612  * @param vIn2 Second input array.
613  * @param vOut Output array.
614  * @param count Count of values.
615  * @return Operation status.
616  */
617 kFx(kStatus) kMath_Div32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
618 
619 /**
620  * Divides the values in two input arrays and stores the result in an output array.
621  *
622  * @public @memberof kMath
623  * @param vIn1 First input array.
624  * @param vIn2 Second input array.
625  * @param vOut Output array.
626  * @param count Count of values.
627  * @return Operation status.
628  */
629 kFx(kStatus) kMath_Div64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
630 
631 /**
632  * Calculates the moving average over an input array and stores the result in an output array.
633  *
634  * @public @memberof kMath
635  * @param vIn Input array.
636  * @param vOut Second input array.
637  * @param count Count of values.
638  * @param window Moving average window size
639  * @return Operation status.
640  */
641 kFx(kStatus) kMath_MovingAvg32s(const k32s* vIn, k32s* vOut, k32u count, k32u window);
642 
643 /**
644  * Calculates the moving average over an input array and stores the result in an output array.
645  *
646  * @public @memberof kMath
647  * @param vIn Input array.
648  * @param vOut Second input array.
649  * @param count Count of values.
650  * @param window Moving average window size
651  * @return Operation status.
652  */
653 kFx(kStatus) kMath_MovingAvg64f(const k64f* vIn, k64f* vOut, k32u count, k32u window);
654 
655 /**
656  * Returns the greatest common divisor of two integers.
657  *
658  * @public @memberof kMath
659  * @param a First integer.
660  * @param b Second integer.
661  * @param result Receives result.
662  * @return Operation status.
663  */
664 kFx(kStatus) kMath_Gcd32s(k32s a, k32s b, k32s* result);
665 
666 /**
667  * Returns the least common multiple of two integers.
668  *
669  * @public @memberof kMath
670  * @param a First Integer.
671  * @param b Second integer.
672  * @param result Receives result.
673  * @return Operation status.
674  */
675 kFx(kStatus) kMath_Lcm32s(k32s a, k32s b, k32s* result);
676 
677 /**
678  * Returns the sign.
679  *
680  * @public @memberof kMath
681  * @param a Integer.
682  * @return Returns the sign.
683  */
684 kFx(k32s) kMath_Sign(k32s a);
685 
686 /**
687  * Calculates the base-2 logarithm of the input, rounded up to the nearest integer.
688  *
689  * @public @memberof kMath
690  * @param a Input value.
691  * @return Base-2 logarithm of input.
692  */
693 kFx(k32u) kMath_Log2Ceil32u(k32u a);
694 
695 kEndHeader()
696 
697 #include <kApi/Data/kMath.x.h>
698 
699 #endif
Represents a 32-bit unsigned integer.
Represents an unsigned integer that can store a pointer address.
Essential API declarations.
Represents a 32-bit signed integer.
Represents a 64-bit signed integer.
Represents an enumeration of error codes.
Represents a 64-bit floating-point number.
Comparison type enumeration.
Represents a boolean value.