From 14496b5b41e6d2e7323d9c5e860e6b56e385a062 Mon Sep 17 00:00:00 2001 From: Siddhesh Wani Date: Tue, 4 Aug 2015 14:36:45 +0530 Subject: Tested Addition and Subtraction for new data types --- src/c/elementaryFunctions/includes/int16.h | 42 ++++++++++++ src/c/elementaryFunctions/includes/int8.h | 42 ++++++++++++ src/c/elementaryFunctions/includes/uint16.h | 42 ++++++++++++ src/c/elementaryFunctions/includes/uint8.h | 42 ++++++++++++ src/c/elementaryFunctions/int16/dint16a.c | 18 +++++ src/c/elementaryFunctions/int16/dint16s.c | 18 +++++ src/c/elementaryFunctions/int16/sint16a.c | 18 +++++ src/c/elementaryFunctions/int16/sint16s.c | 18 +++++ src/c/elementaryFunctions/int8/dint8a.c | 18 +++++ src/c/elementaryFunctions/int8/dint8s.c | 18 +++++ src/c/elementaryFunctions/int8/sint8a.c | 18 +++++ src/c/elementaryFunctions/int8/sint8s.c | 18 +++++ src/c/elementaryFunctions/interfaces/int_int16.h | 26 +++++++ src/c/elementaryFunctions/interfaces/int_int8.h | 26 +++++++ src/c/elementaryFunctions/interfaces/int_uint16.h | 26 +++++++ src/c/elementaryFunctions/interfaces/int_uint8.h | 26 +++++++ src/c/elementaryFunctions/uint16/duint16a.c | 18 +++++ src/c/elementaryFunctions/uint16/duint16s.c | 18 +++++ src/c/elementaryFunctions/uint16/suint16a.c | 18 +++++ src/c/elementaryFunctions/uint16/suint16s.c | 18 +++++ src/c/elementaryFunctions/uint8/duint8a.c | 18 +++++ src/c/elementaryFunctions/uint8/duint8s.c | 18 +++++ src/c/elementaryFunctions/uint8/suint8a.c | 18 +++++ src/c/elementaryFunctions/uint8/suint8s.c | 18 +++++ src/c/operations/addition/i16adda.c | 20 ++++++ src/c/operations/addition/i16adds.c | 18 +++++ src/c/operations/addition/i8adds.c | 18 +++++ src/c/operations/addition/u16adda.c | 20 ++++++ src/c/operations/addition/u16adds.c | 18 +++++ src/c/operations/addition/u8adda.c | 20 ++++++ src/c/operations/addition/u8adds.c | 18 +++++ src/c/operations/includes/addition.h | 81 ++++++++++++++++++++++ src/c/operations/includes/subtraction.h | 83 +++++++++++++++++++++++ src/c/operations/interfaces/int_OpMinus.h | 69 +++++++++++++++++++ src/c/operations/interfaces/int_OpPlus.h | 41 +++++++++++ src/c/operations/subtraction/i16diffa.c | 20 ++++++ src/c/operations/subtraction/i16diffs.c | 18 +++++ src/c/operations/subtraction/i8diffa.c | 20 ++++++ src/c/operations/subtraction/i8diffs.c | 18 +++++ src/c/operations/subtraction/u16diffa.c | 20 ++++++ src/c/operations/subtraction/u16diffs.c | 18 +++++ src/c/operations/subtraction/u8diffa.c | 20 ++++++ src/c/operations/subtraction/u8diffs.c | 18 +++++ 43 files changed, 1118 insertions(+) create mode 100644 src/c/elementaryFunctions/includes/int16.h create mode 100644 src/c/elementaryFunctions/includes/int8.h create mode 100644 src/c/elementaryFunctions/includes/uint16.h create mode 100644 src/c/elementaryFunctions/includes/uint8.h create mode 100644 src/c/elementaryFunctions/int16/dint16a.c create mode 100644 src/c/elementaryFunctions/int16/dint16s.c create mode 100644 src/c/elementaryFunctions/int16/sint16a.c create mode 100644 src/c/elementaryFunctions/int16/sint16s.c create mode 100644 src/c/elementaryFunctions/int8/dint8a.c create mode 100644 src/c/elementaryFunctions/int8/dint8s.c create mode 100644 src/c/elementaryFunctions/int8/sint8a.c create mode 100644 src/c/elementaryFunctions/int8/sint8s.c create mode 100644 src/c/elementaryFunctions/interfaces/int_int16.h create mode 100644 src/c/elementaryFunctions/interfaces/int_int8.h create mode 100644 src/c/elementaryFunctions/interfaces/int_uint16.h create mode 100644 src/c/elementaryFunctions/interfaces/int_uint8.h create mode 100644 src/c/elementaryFunctions/uint16/duint16a.c create mode 100644 src/c/elementaryFunctions/uint16/duint16s.c create mode 100644 src/c/elementaryFunctions/uint16/suint16a.c create mode 100644 src/c/elementaryFunctions/uint16/suint16s.c create mode 100644 src/c/elementaryFunctions/uint8/duint8a.c create mode 100644 src/c/elementaryFunctions/uint8/duint8s.c create mode 100644 src/c/elementaryFunctions/uint8/suint8a.c create mode 100644 src/c/elementaryFunctions/uint8/suint8s.c create mode 100644 src/c/operations/addition/i16adda.c create mode 100644 src/c/operations/addition/i16adds.c create mode 100644 src/c/operations/addition/i8adds.c create mode 100644 src/c/operations/addition/u16adda.c create mode 100644 src/c/operations/addition/u16adds.c create mode 100644 src/c/operations/addition/u8adda.c create mode 100644 src/c/operations/addition/u8adds.c create mode 100644 src/c/operations/subtraction/i16diffa.c create mode 100644 src/c/operations/subtraction/i16diffs.c create mode 100644 src/c/operations/subtraction/i8diffa.c create mode 100644 src/c/operations/subtraction/i8diffs.c create mode 100644 src/c/operations/subtraction/u16diffa.c create mode 100644 src/c/operations/subtraction/u16diffs.c create mode 100644 src/c/operations/subtraction/u8diffa.c create mode 100644 src/c/operations/subtraction/u8diffs.c (limited to 'src') diff --git a/src/c/elementaryFunctions/includes/int16.h b/src/c/elementaryFunctions/includes/int16.h new file mode 100644 index 00000000..f3271849 --- /dev/null +++ b/src/c/elementaryFunctions/includes/int16.h @@ -0,0 +1,42 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Arnaud Torset + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __INT16_H__ +#define __INT16_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + int16(X) returns the signed int part of the double value +*/ + +EXTERN_ELEMFUNCT int16 sint16s(float in); + +EXTERN_ELEMFUNCT int16 dint816s(double in); + +EXTERN_ELEMFUNCT void sint16a(float* in, int size, int16* out); + +EXTERN_ELEMFUNCT void dint16a(double* in, int size, int16* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__INT16_H__ */ + diff --git a/src/c/elementaryFunctions/includes/int8.h b/src/c/elementaryFunctions/includes/int8.h new file mode 100644 index 00000000..12fc595f --- /dev/null +++ b/src/c/elementaryFunctions/includes/int8.h @@ -0,0 +1,42 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Arnaud Torset + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __INT8_H__ +#define __INT8_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + int8(X) returns the signed char part of the double value +*/ + +EXTERN_ELEMFUNCT int8 sint8s(float in); + +EXTERN_ELEMFUNCT int8 dint8s(double in); + +EXTERN_ELEMFUNCT void sint8a(float* in, int size, int8* out); + +EXTERN_ELEMFUNCT void dint8a(double* in, int size, int8* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__INT8_H__ */ + diff --git a/src/c/elementaryFunctions/includes/uint16.h b/src/c/elementaryFunctions/includes/uint16.h new file mode 100644 index 00000000..a0739b67 --- /dev/null +++ b/src/c/elementaryFunctions/includes/uint16.h @@ -0,0 +1,42 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Arnaud Torset + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __UINT16_H__ +#define __UINT16_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + uint16(X) returns the signed int part of the double value +*/ + +EXTERN_ELEMFUNCT uint16 suint16s(float in); + +EXTERN_ELEMFUNCT uint16 duint816s(double in); + +EXTERN_ELEMFUNCT void suint16a(float* in, int size, uint16* out); + +EXTERN_ELEMFUNCT void duint16a(double* in, int size, uint16* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__UINT16_H__ */ + diff --git a/src/c/elementaryFunctions/includes/uint8.h b/src/c/elementaryFunctions/includes/uint8.h new file mode 100644 index 00000000..9d3dd395 --- /dev/null +++ b/src/c/elementaryFunctions/includes/uint8.h @@ -0,0 +1,42 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Arnaud Torset + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __UINT8_H__ +#define __UINT8_H__ + +#include "dynlib_elementaryfunctions.h" +#include "floatComplex.h" +#include "doubleComplex.h" +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/* + uint8(X) returns the unsigned char part of the double value +*/ + +EXTERN_ELEMFUNCT uint8 suint8s(float in); + +EXTERN_ELEMFUNCT uint8 duint8s(double in); + +EXTERN_ELEMFUNCT void suint8a(float* in, int size, uint8* out); + +EXTERN_ELEMFUNCT void duint8a(double* in, int size, uint8* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* !__UINT8_H__ */ + diff --git a/src/c/elementaryFunctions/int16/dint16a.c b/src/c/elementaryFunctions/int16/dint16a.c new file mode 100644 index 00000000..73c9ec74 --- /dev/null +++ b/src/c/elementaryFunctions/int16/dint16a.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Arnaud Torset + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "int16.h" + +void dint16a(double* x, int size, int16* out) { + int i = 0; + for (i=0;i "-1" because '\0' of the first string must be removed. */ #define g2g2OpPlusg2(in1,size1,in2,size2,out) {int i = 0, j = 0; \ diff --git a/src/c/operations/subtraction/i16diffa.c b/src/c/operations/subtraction/i16diffa.c new file mode 100644 index 00000000..ca722af0 --- /dev/null +++ b/src/c/operations/subtraction/i16diffa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +void i16diffa(int16* in1, int size1, int16* in2, int size2, int16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i16diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/i16diffs.c b/src/c/operations/subtraction/i16diffs.c new file mode 100644 index 00000000..6ca2e52c --- /dev/null +++ b/src/c/operations/subtraction/i16diffs.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +int16 i16diffs(int16 in1, int16 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/i8diffa.c b/src/c/operations/subtraction/i8diffa.c new file mode 100644 index 00000000..ec966bf5 --- /dev/null +++ b/src/c/operations/subtraction/i8diffa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +void i8diffa(int8* in1, int size1, int8* in2, int size2, int8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i8diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/i8diffs.c b/src/c/operations/subtraction/i8diffs.c new file mode 100644 index 00000000..bbc9a1a4 --- /dev/null +++ b/src/c/operations/subtraction/i8diffs.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +int8 i8diffs(int8 in1, int8 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/u16diffa.c b/src/c/operations/subtraction/u16diffa.c new file mode 100644 index 00000000..7c216bb8 --- /dev/null +++ b/src/c/operations/subtraction/u16diffa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +void u16diffa(uint16* in1, int size1, uint16* in2, int size2, uint16* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u16diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/u16diffs.c b/src/c/operations/subtraction/u16diffs.c new file mode 100644 index 00000000..bd52d66a --- /dev/null +++ b/src/c/operations/subtraction/u16diffs.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +uint16 u16diffs(uint16 in1, uint16 in2) +{ + return (in1 - in2); +} diff --git a/src/c/operations/subtraction/u8diffa.c b/src/c/operations/subtraction/u8diffa.c new file mode 100644 index 00000000..42c06f7d --- /dev/null +++ b/src/c/operations/subtraction/u8diffa.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +void u8diffa(uint8* in1, int size1, uint8* in2, int size2, uint8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = u8diffs(in1[i], in2[i]); + } +} diff --git a/src/c/operations/subtraction/u8diffs.c b/src/c/operations/subtraction/u8diffs.c new file mode 100644 index 00000000..bc9beacb --- /dev/null +++ b/src/c/operations/subtraction/u8diffs.c @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "subtraction.h" + +uint8 u8diffs(uint8 in1, uint8 in2) +{ + return (in1 - in2); +} -- cgit