xref: /OK3568_Linux_fs/external/security/rk_tee_user/v2/ta/vector_util/c_algo.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  *
3  * Copyright (c) 1994
4  * Hewlett-Packard Company
5  *
6  * Permission to use, copy, modify, distribute and sell this software
7  * and its documentation for any purpose is hereby granted without fee,
8  * provided that the above copyright notice appear in all copies and
9  * that both that copyright notice and this permission notice appear
10  * in supporting documentation.  Hewlett-Packard Company makes no
11  * representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  *
14  *
15  * Copyright (c) 1996
16  * Silicon Graphics Computer Systems, Inc.
17  *
18  * Permission to use, copy, modify, distribute and sell this software
19  * and its documentation for any purpose is hereby granted without fee,
20  * provided that the above copyright notice appear in all copies and
21  * that both that copyright notice and this permission notice appear
22  * in supporting documentation.  Silicon Graphics makes no
23  * representations about the suitability of this software for any
24  * purpose.  It is provided "as is" without express or implied warranty.
25  */
26 
27 /*
28 Copyright (c) 2007 Lao wen bo
29 
30 This software is provided 'as-is', without any express or implied
31 warranty. In no event will the authors be held liable for any damages
32 arising from the use of this software.
33 
34 Permission is granted to anyone to use this software for any purpose,
35 including commercial applications, and to alter it and redistribute it
36 freely, subject to the following restrictions:
37 
38     1. The origin of this software must not be misrepresented; you must not
39     claim that you wrote the original software. If you use this software
40     in a product, an acknowledgment in the product documentation would be
41     appreciated but is not required.
42 
43     2. Altered source versions must be plainly marked as such, and must not be
44     misrepresented as being the original software.
45 
46     3. This notice may not be removed or altered from any source
47     distribution.
48 
49 	Lao wen bo
50 	viewpl(at)gmail.com
51 */
52 
53 /*
54 NOTE: This is an internal header file, You should not attempt to use it directly.
55 */
56 
57 #ifndef _C_ALGO_H
58 #define _C_ALGO_H
59 
60 #include "c_iterator.h"
61 #include "c_function.h"
62 
63 #define c_iter_swap			_c_iter_swap
64 #define c_copy                          _c_copy
65 #define c_copy_backward                 _c_copy_backward
66 #define c_lexicographical_compare       _c_lexicographical_compare
67 #define c_uninitialized_copy            _c_uninitialized_copy
68 #define c_fill                          _c_fill
69 #define c_fill_n                        _c_fill_n
70 #define c_uninitialized_fill_n          _c_unintialized_fill_n
71 #define c_equal                         _c_equal
72 #define c_equal2                        _c_equal2
73 #define c_for_each			_c_for_each
74 #define c_find				_c_find
75 #define c_find_if			_c_find_if
76 #define c_adjacent_find			_c_adjacent_find
77 #define c_count				_c_count
78 #define c_count_if			_c_count_if
79 #define c_reverse			_c_reverse
80 #define c_search			_c_search
81 
82 void c_iter_swap(c_iterator x, c_iterator y);
83 c_iterator c_copy(c_iterator first, c_iterator last, c_iterator result);
84 c_iterator c_copy_backward(c_iterator first, c_iterator last, c_iterator result);
85 c_bool c_lexicographical_compare(c_iterator first1,
86                                     c_iterator last1,
87                                     c_iterator first2,
88                                     c_iterator last2,
89                                     COMPARER cmp);
90 c_iterator c_uninitialized_copy(c_iterator first, c_iterator last, c_iterator result);
91 void c_fill(c_iterator first, c_iterator last, const value_type val);
92 c_iterator c_fill_n(c_iterator first, size_type n, const value_type val);
93 c_iterator c_uninitialized_fill_n(c_iterator first, size_type n, const value_type val);
94 c_bool c_equal(c_iterator first1, c_iterator last1, c_iterator first2, BINARY_PREDICATE pf);
95 c_bool c_equal2(c_iterator first1, c_iterator last1, c_iterator first2, c_binary_predicate binary_pred);
96 UNARY_FUNCTION c_for_each(c_iterator first, c_iterator last, UNARY_FUNCTION pf);
97 c_iterator c_find(c_iterator first, c_iterator last, const value_type val);
98 c_iterator c_find_if(c_iterator first, c_iterator last, UNARY_PREDICATE pf);
99 c_iterator c_adjacent_find(c_iterator first, c_iterator last, BINARY_PREDICATE pf);
100 size_type c_count(c_iterator first, c_iterator last, const value_type val);
101 size_type c_count_if(c_iterator first, c_iterator last, UNARY_PREDICATE pf);
102 void c_reverse(c_iterator first, c_iterator last);
103 c_iterator c_search(c_iterator first1,
104 			c_iterator last1,
105 			c_iterator first2,
106 			c_iterator last2,
107 			BINARY_PREDICATE pf);
108 
109 
110 #define C_SWAP(X, Y, TMP)   do{(TMP)=(X);(X)=(Y);(Y)=(TMP);}while(0)
111 #define C_MAX(X, Y) ((X) >= (Y) ? (X) : (Y))
112 #define C_MIN(X, Y) ((X) <= (Y) ? (X) : (Y))
113 
114 #endif /* _C_ALGO_H */
115