Blame libfreerdp/primitives/prim_andor.c

Packit 1fb8d4
/* FreeRDP: A Remote Desktop Protocol Client
Packit 1fb8d4
 * Logical operations.
Packit 1fb8d4
 * vi:ts=4 sw=4:
Packit 1fb8d4
 *
Packit 1fb8d4
 * (c) Copyright 2012 Hewlett-Packard Development Company, L.P.
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Packit 1fb8d4
 * not use this file except in compliance with the License. You may obtain
Packit 1fb8d4
 * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
Packit 1fb8d4
 * or implied. See the License for the specific language governing
Packit 1fb8d4
 * permissions and limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifdef HAVE_CONFIG_H
Packit 1fb8d4
#include "config.h"
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/types.h>
Packit 1fb8d4
#include <freerdp/primitives.h>
Packit 1fb8d4
Packit 1fb8d4
#include "prim_internal.h"
Packit 1fb8d4
Packit 1fb8d4
/* ----------------------------------------------------------------------------
Packit 1fb8d4
 * 32-bit AND with a constant.
Packit 1fb8d4
 */
Packit 1fb8d4
static pstatus_t general_andC_32u(
Packit 1fb8d4
    const UINT32* pSrc,
Packit 1fb8d4
    UINT32 val,
Packit 1fb8d4
    UINT32* pDst,
Packit 1fb8d4
    INT32 len)
Packit 1fb8d4
{
Packit 1fb8d4
	if (val == 0)
Packit 1fb8d4
		return PRIMITIVES_SUCCESS;
Packit 1fb8d4
Packit 1fb8d4
	while (len--)
Packit 1fb8d4
		*pDst++ = *pSrc++ & val;
Packit 1fb8d4
Packit 1fb8d4
	return PRIMITIVES_SUCCESS;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/* ----------------------------------------------------------------------------
Packit 1fb8d4
 * 32-bit OR with a constant.
Packit 1fb8d4
 */
Packit 1fb8d4
static pstatus_t general_orC_32u(
Packit 1fb8d4
    const UINT32* pSrc,
Packit 1fb8d4
    UINT32 val,
Packit 1fb8d4
    UINT32* pDst,
Packit 1fb8d4
    INT32 len)
Packit 1fb8d4
{
Packit 1fb8d4
	if (val == 0)
Packit 1fb8d4
		return PRIMITIVES_SUCCESS;
Packit 1fb8d4
Packit 1fb8d4
	while (len--)
Packit 1fb8d4
		*pDst++ = *pSrc++ | val;
Packit 1fb8d4
Packit 1fb8d4
	return PRIMITIVES_SUCCESS;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/* ------------------------------------------------------------------------- */
Packit 1fb8d4
void primitives_init_andor(
Packit 1fb8d4
    primitives_t* prims)
Packit 1fb8d4
{
Packit 1fb8d4
	/* Start with the default. */
Packit 1fb8d4
	prims->andC_32u = general_andC_32u;
Packit 1fb8d4
	prims->orC_32u  = general_orC_32u;
Packit 1fb8d4
}