/src/FreeRDP/libfreerdp/primitives/prim_andor.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /* FreeRDP: A Remote Desktop Protocol Client  | 
2  |  |  * Logical operations.  | 
3  |  |  * vi:ts=4 sw=4:  | 
4  |  |  *  | 
5  |  |  * (c) Copyright 2012 Hewlett-Packard Development Company, L.P.  | 
6  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); you may  | 
7  |  |  * not use this file except in compliance with the License. You may obtain  | 
8  |  |  * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.  | 
9  |  |  * Unless required by applicable law or agreed to in writing, software  | 
10  |  |  * distributed under the License is distributed on an "AS IS" BASIS,  | 
11  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express  | 
12  |  |  * or implied. See the License for the specific language governing  | 
13  |  |  * permissions and limitations under the License.  | 
14  |  |  */  | 
15  |  |  | 
16  |  | #include <freerdp/config.h>  | 
17  |  |  | 
18  |  | #include <freerdp/types.h>  | 
19  |  | #include <freerdp/primitives.h>  | 
20  |  |  | 
21  |  | #include "prim_internal.h"  | 
22  |  | #include "prim_andor.h"  | 
23  |  |  | 
24  |  | /* ----------------------------------------------------------------------------  | 
25  |  |  * 32-bit AND with a constant.  | 
26  |  |  */  | 
27  |  | static pstatus_t general_andC_32u(const UINT32* pSrc, UINT32 val, UINT32* pDst, INT32 len)  | 
28  | 0  | { | 
29  | 0  |   if (val == 0)  | 
30  | 0  |     return PRIMITIVES_SUCCESS;  | 
31  |  |  | 
32  | 0  |   while (len--)  | 
33  | 0  |     *pDst++ = *pSrc++ & val;  | 
34  |  | 
  | 
35  | 0  |   return PRIMITIVES_SUCCESS;  | 
36  | 0  | }  | 
37  |  |  | 
38  |  | /* ----------------------------------------------------------------------------  | 
39  |  |  * 32-bit OR with a constant.  | 
40  |  |  */  | 
41  |  | static pstatus_t general_orC_32u(const UINT32* pSrc, UINT32 val, UINT32* pDst, INT32 len)  | 
42  | 0  | { | 
43  | 0  |   if (val == 0)  | 
44  | 0  |     return PRIMITIVES_SUCCESS;  | 
45  |  |  | 
46  | 0  |   while (len--)  | 
47  | 0  |     *pDst++ = *pSrc++ | val;  | 
48  |  | 
  | 
49  | 0  |   return PRIMITIVES_SUCCESS;  | 
50  | 0  | }  | 
51  |  |  | 
52  |  | /* ------------------------------------------------------------------------- */  | 
53  |  | void primitives_init_andor(primitives_t* prims)  | 
54  | 0  | { | 
55  |  |   /* Start with the default. */  | 
56  | 0  |   prims->andC_32u = general_andC_32u;  | 
57  | 0  |   prims->orC_32u = general_orC_32u;  | 
58  | 0  | }  | 
59  |  |  | 
60  |  | void primitives_init_andor_opt(primitives_t* WINPR_RESTRICT prims)  | 
61  | 0  | { | 
62  | 0  |   primitives_init_andor_sse3(prims);  | 
63  | 0  | }  |