sl@0: /* This file is autogenerated.  Do not edit. */
sl@0: /*
sl@0:  * LIBOIL - Library of Optimized Inner Loops
sl@0:  * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
sl@0:  * All rights reserved.
sl@0:  *
sl@0:  * Redistribution and use in source and binary forms, with or without
sl@0:  * modification, are permitted provided that the following conditions
sl@0:  * are met:
sl@0:  * 1. Redistributions of source code must retain the above copyright
sl@0:  *    notice, this list of conditions and the following disclaimer.
sl@0:  * 2. Redistributions in binary form must reproduce the above copyright
sl@0:  *    notice, this list of conditions and the following disclaimer in the
sl@0:  *    documentation and/or other materials provided with the distribution.
sl@0:  * 
sl@0:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
sl@0:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
sl@0:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
sl@0:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
sl@0:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sl@0:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sl@0:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
sl@0:  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
sl@0:  * POSSIBILITY OF SUCH DAMAGE.
sl@0:  */
sl@0: //Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
sl@0: 
sl@0: #ifdef HAVE_CONFIG_H
sl@0: #include "config.h"
sl@0: #endif
sl@0: 
sl@0: #include <math.h>
sl@0: 
sl@0: #include "liboil/liboil.h"
sl@0: #include "liboil/liboilclasses.h"
sl@0: 
sl@0: static void
sl@0: clamp_s8_pointer (oil_type_s8 *dest, oil_type_s8 *src1,
sl@0:     int n
sl@0:     , oil_type_s8 *low
sl@0:     , oil_type_s8 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s8 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s8_pointer, clamp_s8);
sl@0: 
sl@0: static void
sl@0: clamp_u8_pointer (oil_type_u8 *dest, oil_type_u8 *src1,
sl@0:     int n
sl@0:     , oil_type_u8 *low
sl@0:     , oil_type_u8 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u8 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u8_pointer, clamp_u8);
sl@0: 
sl@0: static void
sl@0: clamp_s16_pointer (oil_type_s16 *dest, oil_type_s16 *src1,
sl@0:     int n
sl@0:     , oil_type_s16 *low
sl@0:     , oil_type_s16 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s16 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s16_pointer, clamp_s16);
sl@0: 
sl@0: static void
sl@0: clamp_u16_pointer (oil_type_u16 *dest, oil_type_u16 *src1,
sl@0:     int n
sl@0:     , oil_type_u16 *low
sl@0:     , oil_type_u16 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u16 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u16_pointer, clamp_u16);
sl@0: 
sl@0: static void
sl@0: clamp_s32_pointer (oil_type_s32 *dest, oil_type_s32 *src1,
sl@0:     int n
sl@0:     , oil_type_s32 *low
sl@0:     , oil_type_s32 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s32 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s32_pointer, clamp_s32);
sl@0: 
sl@0: static void
sl@0: clamp_u32_pointer (oil_type_u32 *dest, oil_type_u32 *src1,
sl@0:     int n
sl@0:     , oil_type_u32 *low
sl@0:     , oil_type_u32 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u32 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u32_pointer, clamp_u32);
sl@0: 
sl@0: static void
sl@0: clamp_s8_unroll4 (oil_type_s8 *dest, oil_type_s8 *src,
sl@0:     int n , oil_type_s8 *low, oil_type_s8 *high)
sl@0: {
sl@0:   oil_type_s8 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s8_unroll4, clamp_s8);
sl@0: 
sl@0: static void
sl@0: clamp_u8_unroll4 (oil_type_u8 *dest, oil_type_u8 *src,
sl@0:     int n , oil_type_u8 *low, oil_type_u8 *high)
sl@0: {
sl@0:   oil_type_u8 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u8_unroll4, clamp_u8);
sl@0: 
sl@0: static void
sl@0: clamp_s16_unroll4 (oil_type_s16 *dest, oil_type_s16 *src,
sl@0:     int n , oil_type_s16 *low, oil_type_s16 *high)
sl@0: {
sl@0:   oil_type_s16 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s16_unroll4, clamp_s16);
sl@0: 
sl@0: static void
sl@0: clamp_u16_unroll4 (oil_type_u16 *dest, oil_type_u16 *src,
sl@0:     int n , oil_type_u16 *low, oil_type_u16 *high)
sl@0: {
sl@0:   oil_type_u16 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u16_unroll4, clamp_u16);
sl@0: 
sl@0: static void
sl@0: clamp_s32_unroll4 (oil_type_s32 *dest, oil_type_s32 *src,
sl@0:     int n , oil_type_s32 *low, oil_type_s32 *high)
sl@0: {
sl@0:   oil_type_s32 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s32_unroll4, clamp_s32);
sl@0: 
sl@0: static void
sl@0: clamp_u32_unroll4 (oil_type_u32 *dest, oil_type_u32 *src,
sl@0:     int n , oil_type_u32 *low, oil_type_u32 *high)
sl@0: {
sl@0:   oil_type_u32 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u32_unroll4, clamp_u32);
sl@0: 
sl@0: static void
sl@0: clamp_s8_trick (oil_type_s8 *dest, oil_type_s8 *src,
sl@0:     int n , oil_type_s8 *low, oil_type_s8 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s8_trick, clamp_s8);
sl@0: 
sl@0: static void
sl@0: clamp_u8_trick (oil_type_u8 *dest, oil_type_u8 *src,
sl@0:     int n , oil_type_u8 *low, oil_type_u8 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u8_trick, clamp_u8);
sl@0: 
sl@0: static void
sl@0: clamp_s16_trick (oil_type_s16 *dest, oil_type_s16 *src,
sl@0:     int n , oil_type_s16 *low, oil_type_s16 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_s16_trick, clamp_s16);
sl@0: 
sl@0: static void
sl@0: clamp_u16_trick (oil_type_u16 *dest, oil_type_u16 *src,
sl@0:     int n , oil_type_u16 *low, oil_type_u16 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamp_u16_trick, clamp_u16);
sl@0: 
sl@0: static void
sl@0: clamphigh_s8_pointer (oil_type_s8 *dest, oil_type_s8 *src1,
sl@0:     int n
sl@0:     , oil_type_s8 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s8 x = *src1;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s8_pointer, clamphigh_s8);
sl@0: 
sl@0: static void
sl@0: clamphigh_u8_pointer (oil_type_u8 *dest, oil_type_u8 *src1,
sl@0:     int n
sl@0:     , oil_type_u8 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u8 x = *src1;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u8_pointer, clamphigh_u8);
sl@0: 
sl@0: static void
sl@0: clamphigh_s16_pointer (oil_type_s16 *dest, oil_type_s16 *src1,
sl@0:     int n
sl@0:     , oil_type_s16 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s16 x = *src1;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s16_pointer, clamphigh_s16);
sl@0: 
sl@0: static void
sl@0: clamphigh_u16_pointer (oil_type_u16 *dest, oil_type_u16 *src1,
sl@0:     int n
sl@0:     , oil_type_u16 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u16 x = *src1;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u16_pointer, clamphigh_u16);
sl@0: 
sl@0: static void
sl@0: clamphigh_s32_pointer (oil_type_s32 *dest, oil_type_s32 *src1,
sl@0:     int n
sl@0:     , oil_type_s32 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s32 x = *src1;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s32_pointer, clamphigh_s32);
sl@0: 
sl@0: static void
sl@0: clamphigh_u32_pointer (oil_type_u32 *dest, oil_type_u32 *src1,
sl@0:     int n
sl@0:     , oil_type_u32 *high
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u32 x = *src1;
sl@0:     if (x > *high) x = *high;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u32_pointer, clamphigh_u32);
sl@0: 
sl@0: static void
sl@0: clamphigh_s8_unroll4 (oil_type_s8 *dest, oil_type_s8 *src,
sl@0:     int n , oil_type_s8 *high)
sl@0: {
sl@0:   oil_type_s8 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s8_unroll4, clamphigh_s8);
sl@0: 
sl@0: static void
sl@0: clamphigh_u8_unroll4 (oil_type_u8 *dest, oil_type_u8 *src,
sl@0:     int n , oil_type_u8 *high)
sl@0: {
sl@0:   oil_type_u8 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u8_unroll4, clamphigh_u8);
sl@0: 
sl@0: static void
sl@0: clamphigh_s16_unroll4 (oil_type_s16 *dest, oil_type_s16 *src,
sl@0:     int n , oil_type_s16 *high)
sl@0: {
sl@0:   oil_type_s16 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s16_unroll4, clamphigh_s16);
sl@0: 
sl@0: static void
sl@0: clamphigh_u16_unroll4 (oil_type_u16 *dest, oil_type_u16 *src,
sl@0:     int n , oil_type_u16 *high)
sl@0: {
sl@0:   oil_type_u16 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u16_unroll4, clamphigh_u16);
sl@0: 
sl@0: static void
sl@0: clamphigh_s32_unroll4 (oil_type_s32 *dest, oil_type_s32 *src,
sl@0:     int n , oil_type_s32 *high)
sl@0: {
sl@0:   oil_type_s32 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s32_unroll4, clamphigh_s32);
sl@0: 
sl@0: static void
sl@0: clamphigh_u32_unroll4 (oil_type_u32 *dest, oil_type_u32 *src,
sl@0:     int n , oil_type_u32 *high)
sl@0: {
sl@0:   oil_type_u32 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x > *high) x = *high;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u32_unroll4, clamphigh_u32);
sl@0: 
sl@0: static void
sl@0: clamphigh_s8_trick (oil_type_s8 *dest, oil_type_s8 *src,
sl@0:     int n , oil_type_s8 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s8_trick, clamphigh_s8);
sl@0: 
sl@0: static void
sl@0: clamphigh_u8_trick (oil_type_u8 *dest, oil_type_u8 *src,
sl@0:     int n , oil_type_u8 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u8_trick, clamphigh_u8);
sl@0: 
sl@0: static void
sl@0: clamphigh_s16_trick (oil_type_s16 *dest, oil_type_s16 *src,
sl@0:     int n , oil_type_s16 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_s16_trick, clamphigh_s16);
sl@0: 
sl@0: static void
sl@0: clamphigh_u16_trick (oil_type_u16 *dest, oil_type_u16 *src,
sl@0:     int n , oil_type_u16 *high)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x + (((*high-x)>>31)&(*high-x));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamphigh_u16_trick, clamphigh_u16);
sl@0: 
sl@0: static void
sl@0: clamplow_s8_pointer (oil_type_s8 *dest, oil_type_s8 *src1,
sl@0:     int n
sl@0:     , oil_type_s8 *low
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s8 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s8_pointer, clamplow_s8);
sl@0: 
sl@0: static void
sl@0: clamplow_u8_pointer (oil_type_u8 *dest, oil_type_u8 *src1,
sl@0:     int n
sl@0:     , oil_type_u8 *low
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u8 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u8_pointer, clamplow_u8);
sl@0: 
sl@0: static void
sl@0: clamplow_s16_pointer (oil_type_s16 *dest, oil_type_s16 *src1,
sl@0:     int n
sl@0:     , oil_type_s16 *low
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s16 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s16_pointer, clamplow_s16);
sl@0: 
sl@0: static void
sl@0: clamplow_u16_pointer (oil_type_u16 *dest, oil_type_u16 *src1,
sl@0:     int n
sl@0:     , oil_type_u16 *low
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u16 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u16_pointer, clamplow_u16);
sl@0: 
sl@0: static void
sl@0: clamplow_s32_pointer (oil_type_s32 *dest, oil_type_s32 *src1,
sl@0:     int n
sl@0:     , oil_type_s32 *low
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_s32 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s32_pointer, clamplow_s32);
sl@0: 
sl@0: static void
sl@0: clamplow_u32_pointer (oil_type_u32 *dest, oil_type_u32 *src1,
sl@0:     int n
sl@0:     , oil_type_u32 *low
sl@0:     )
sl@0: {
sl@0:   while (n) {
sl@0:     oil_type_u32 x = *src1;
sl@0:     if (x < *low) x = *low;
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src1++;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u32_pointer, clamplow_u32);
sl@0: 
sl@0: static void
sl@0: clamplow_s8_unroll4 (oil_type_s8 *dest, oil_type_s8 *src,
sl@0:     int n , oil_type_s8 *low)
sl@0: {
sl@0:   oil_type_s8 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s8_unroll4, clamplow_s8);
sl@0: 
sl@0: static void
sl@0: clamplow_u8_unroll4 (oil_type_u8 *dest, oil_type_u8 *src,
sl@0:     int n , oil_type_u8 *low)
sl@0: {
sl@0:   oil_type_u8 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u8_unroll4, clamplow_u8);
sl@0: 
sl@0: static void
sl@0: clamplow_s16_unroll4 (oil_type_s16 *dest, oil_type_s16 *src,
sl@0:     int n , oil_type_s16 *low)
sl@0: {
sl@0:   oil_type_s16 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s16_unroll4, clamplow_s16);
sl@0: 
sl@0: static void
sl@0: clamplow_u16_unroll4 (oil_type_u16 *dest, oil_type_u16 *src,
sl@0:     int n , oil_type_u16 *low)
sl@0: {
sl@0:   oil_type_u16 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u16_unroll4, clamplow_u16);
sl@0: 
sl@0: static void
sl@0: clamplow_s32_unroll4 (oil_type_s32 *dest, oil_type_s32 *src,
sl@0:     int n , oil_type_s32 *low)
sl@0: {
sl@0:   oil_type_s32 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s32_unroll4, clamplow_s32);
sl@0: 
sl@0: static void
sl@0: clamplow_u32_unroll4 (oil_type_u32 *dest, oil_type_u32 *src,
sl@0:     int n , oil_type_u32 *low)
sl@0: {
sl@0:   oil_type_u32 x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     if (x < *low) x = *low;
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u32_unroll4, clamplow_u32);
sl@0: 
sl@0: static void
sl@0: clamplow_s8_trick (oil_type_s8 *dest, oil_type_s8 *src,
sl@0:     int n , oil_type_s8 *low)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s8_trick, clamplow_s8);
sl@0: 
sl@0: static void
sl@0: clamplow_u8_trick (oil_type_u8 *dest, oil_type_u8 *src,
sl@0:     int n , oil_type_u8 *low)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u8_trick, clamplow_u8);
sl@0: 
sl@0: static void
sl@0: clamplow_s16_trick (oil_type_s16 *dest, oil_type_s16 *src,
sl@0:     int n , oil_type_s16 *low)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_s16_trick, clamplow_s16);
sl@0: 
sl@0: static void
sl@0: clamplow_u16_trick (oil_type_u16 *dest, oil_type_u16 *src,
sl@0:     int n , oil_type_u16 *low)
sl@0: {
sl@0:   int x;
sl@0:   while (n&3) {
sl@0:     x = *src;
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     *dest = x;
sl@0:     dest++;
sl@0:     src++;
sl@0:     n--;
sl@0:   }
sl@0:   n >>= 2;
sl@0:   while (n) {
sl@0:     x = src[0];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[0] = x;
sl@0:     x = src[1];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[1] = x;
sl@0:     x = src[2];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[2] = x;
sl@0:     x = src[3];
sl@0:     x = x - (((x-*low)>>31)&(x-*low));
sl@0: 
sl@0:     dest[3] = x;
sl@0:     dest+=4;
sl@0:     src+=4;
sl@0:     n--;
sl@0:   }
sl@0: }
sl@0: OIL_DEFINE_IMPL (clamplow_u16_trick, clamplow_u16);
sl@0: 
sl@0: 
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s8_pointer() {
sl@0: 		return &_oil_function_impl_clamp_s8_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u8_pointer() {
sl@0: 		return &_oil_function_impl_clamp_u8_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s16_pointer() {
sl@0: 		return &_oil_function_impl_clamp_s16_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u16_pointer() {
sl@0: 		return &_oil_function_impl_clamp_u16_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s32_pointer() {
sl@0: 		return &_oil_function_impl_clamp_s32_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u32_pointer() {
sl@0: 		return &_oil_function_impl_clamp_u32_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s8_unroll4() {
sl@0: 		return &_oil_function_impl_clamp_s8_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u8_unroll4() {
sl@0: 		return &_oil_function_impl_clamp_u8_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s16_unroll4() {
sl@0: 		return &_oil_function_impl_clamp_s16_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u16_unroll4() {
sl@0: 		return &_oil_function_impl_clamp_u16_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s32_unroll4() {
sl@0: 		return &_oil_function_impl_clamp_s32_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u32_unroll4() {
sl@0: 		return &_oil_function_impl_clamp_u32_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s8_trick() {
sl@0: 		return &_oil_function_impl_clamp_s8_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u8_trick() {
sl@0: 		return &_oil_function_impl_clamp_u8_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_s16_trick() {
sl@0: 		return &_oil_function_impl_clamp_s16_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamp_u16_trick() {
sl@0: 		return &_oil_function_impl_clamp_u16_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s8_pointer() {
sl@0: 		return &_oil_function_impl_clamphigh_s8_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u8_pointer() {
sl@0: 		return &_oil_function_impl_clamphigh_u8_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s16_pointer() {
sl@0: 		return &_oil_function_impl_clamphigh_s16_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u16_pointer() {
sl@0: 		return &_oil_function_impl_clamphigh_u16_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s32_pointer() {
sl@0: 		return &_oil_function_impl_clamphigh_s32_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u32_pointer() {
sl@0: 		return &_oil_function_impl_clamphigh_u32_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s8_unroll4() {
sl@0: 		return &_oil_function_impl_clamphigh_s8_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u8_unroll4() {
sl@0: 		return &_oil_function_impl_clamphigh_u8_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s16_unroll4() {
sl@0: 		return &_oil_function_impl_clamphigh_s16_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u16_unroll4() {
sl@0: 		return &_oil_function_impl_clamphigh_u16_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s32_unroll4() {
sl@0: 		return &_oil_function_impl_clamphigh_s32_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u32_unroll4() {
sl@0: 		return &_oil_function_impl_clamphigh_u32_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s8_trick() {
sl@0: 		return &_oil_function_impl_clamphigh_s8_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u8_trick() {
sl@0: 		return &_oil_function_impl_clamphigh_u8_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_s16_trick() {
sl@0: 		return &_oil_function_impl_clamphigh_s16_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamphigh_u16_trick() {
sl@0: 		return &_oil_function_impl_clamphigh_u16_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s8_pointer() {
sl@0: 		return &_oil_function_impl_clamplow_s8_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u8_pointer() {
sl@0: 		return &_oil_function_impl_clamplow_u8_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s16_pointer() {
sl@0: 		return &_oil_function_impl_clamplow_s16_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u16_pointer() {
sl@0: 		return &_oil_function_impl_clamplow_u16_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s32_pointer() {
sl@0: 		return &_oil_function_impl_clamplow_s32_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u32_pointer() {
sl@0: 		return &_oil_function_impl_clamplow_u32_pointer;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s8_unroll4() {
sl@0: 		return &_oil_function_impl_clamplow_s8_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u8_unroll4() {
sl@0: 		return &_oil_function_impl_clamplow_u8_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s16_unroll4() {
sl@0: 		return &_oil_function_impl_clamplow_s16_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u16_unroll4() {
sl@0: 		return &_oil_function_impl_clamplow_u16_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s32_unroll4() {
sl@0: 		return &_oil_function_impl_clamplow_s32_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u32_unroll4() {
sl@0: 		return &_oil_function_impl_clamplow_u32_unroll4;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s8_trick() {
sl@0: 		return &_oil_function_impl_clamplow_s8_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u8_trick() {
sl@0: 		return &_oil_function_impl_clamplow_u8_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_s16_trick() {
sl@0: 		return &_oil_function_impl_clamplow_s16_trick;
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #ifdef	__SYMBIAN32__
sl@0:  
sl@0: OilFunctionImpl* __oil_function_impl_clamplow_u16_trick() {
sl@0: 		return &_oil_function_impl_clamplow_u16_trick;
sl@0: }
sl@0: #endif
sl@0: