summaryrefslogtreecommitdiff
path: root/src/c/auxiliaryFunctions/sign
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/auxiliaryFunctions/sign')
-rw-r--r--src/c/auxiliaryFunctions/sign/i16signa.c22
-rw-r--r--src/c/auxiliaryFunctions/sign/i16signs.c25
-rw-r--r--src/c/auxiliaryFunctions/sign/i8signa.c22
-rw-r--r--src/c/auxiliaryFunctions/sign/i8signs.c25
-rw-r--r--src/c/auxiliaryFunctions/sign/u16signa.c22
-rw-r--r--src/c/auxiliaryFunctions/sign/u16signs.c24
-rw-r--r--src/c/auxiliaryFunctions/sign/u8signa.c22
-rw-r--r--src/c/auxiliaryFunctions/sign/u8signs.c25
8 files changed, 187 insertions, 0 deletions
diff --git a/src/c/auxiliaryFunctions/sign/i16signa.c b/src/c/auxiliaryFunctions/sign/i16signa.c
new file mode 100644
index 00000000..a2b61823
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/i16signa.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+void i16signa(int16 *in, int size, int16 *out) {
+ int i = 0;
+
+ for (i = 0 ; i < size ; ++i) {
+ out[i] = i16signs(in[i]);
+ }
+}
diff --git a/src/c/auxiliaryFunctions/sign/i16signs.c b/src/c/auxiliaryFunctions/sign/i16signs.c
new file mode 100644
index 00000000..b6e70a8a
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/i16signs.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+int16 i16signs(int16 num) {
+ if (num > 0) {
+ return (int16)1;
+ }
+ if (num < 0) {
+ return (int16)-1;
+ }
+ /* num == 0 */
+ return (int16)0;
+}
diff --git a/src/c/auxiliaryFunctions/sign/i8signa.c b/src/c/auxiliaryFunctions/sign/i8signa.c
new file mode 100644
index 00000000..3390b042
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/i8signa.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+void i8signa(int8 *in, int size, int8 *out) {
+ int i = 0;
+
+ for (i = 0 ; i < size ; ++i) {
+ out[i] = i8signs(in[i]);
+ }
+}
diff --git a/src/c/auxiliaryFunctions/sign/i8signs.c b/src/c/auxiliaryFunctions/sign/i8signs.c
new file mode 100644
index 00000000..4bbefeb3
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/i8signs.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+int8 i8signs(int8 num) {
+ if (num > 0) {
+ return (int8)1;
+ }
+ if (num < 0) {
+ return (int8)-1;
+ }
+ /* num == 0 */
+ return (int8)0;
+}
diff --git a/src/c/auxiliaryFunctions/sign/u16signa.c b/src/c/auxiliaryFunctions/sign/u16signa.c
new file mode 100644
index 00000000..b962ee2d
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/u16signa.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+void u16signa(uint16 *in, int size, int16 *out) {
+ int i = 0;
+
+ for (i = 0 ; i < size ; ++i) {
+ out[i] = u16signs(in[i]);
+ }
+}
diff --git a/src/c/auxiliaryFunctions/sign/u16signs.c b/src/c/auxiliaryFunctions/sign/u16signs.c
new file mode 100644
index 00000000..d04d19cd
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/u16signs.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+#include "sign.h"
+
+int16 u16signs(uint16 num) {
+ if (num > 0) {
+ return (int16)1;
+ }
+ if (num < 0) {
+ return (int16)-1;
+ }
+ /* num == 0 */
+ return (int16)0;
+}
diff --git a/src/c/auxiliaryFunctions/sign/u8signa.c b/src/c/auxiliaryFunctions/sign/u8signa.c
new file mode 100644
index 00000000..980931ec
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/u8signa.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+void u8signa(uint8 *in, int size, int8 *out) {
+ int i = 0;
+
+ for (i = 0 ; i < size ; ++i) {
+ out[i] = u8signs(in[i]);
+ }
+}
diff --git a/src/c/auxiliaryFunctions/sign/u8signs.c b/src/c/auxiliaryFunctions/sign/u8signs.c
new file mode 100644
index 00000000..69d766b0
--- /dev/null
+++ b/src/c/auxiliaryFunctions/sign/u8signs.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - IIT Bombay - FOSSEE
+
+ 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
+ Author: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "sign.h"
+
+int8 u8signs(uint8 num) {
+ if (num > 0) {
+ return (int8)1;
+ }
+ if (num < 0) {
+ return (int8)-1;
+ }
+ /* num == 0 */
+ return (int8)0;
+}