summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec
diff options
context:
space:
mode:
authorSandeep Gupta2017-06-18 23:55:40 +0530
committerSandeep Gupta2017-06-18 23:55:40 +0530
commitb43eccd4cffed5bd1017c5821524fb6e49202f78 (patch)
tree4c53d798252cbeae9bcf7dc9604524b20bb10f27 /2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec
downloadScilab2C-b43eccd4cffed5bd1017c5821524fb6e49202f78.tar.gz
Scilab2C-b43eccd4cffed5bd1017c5821524fb6e49202f78.tar.bz2
Scilab2C-b43eccd4cffed5bd1017c5821524fb6e49202f78.zip
First commit
Diffstat (limited to '2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec')
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c21
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c32
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c21
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c32
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c21
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c32
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c21
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c32
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c21
-rw-r--r--2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c32
10 files changed, 265 insertions, 0 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c
new file mode 100644
index 00000000..96fccc5f
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include "bin2dec.h"
+
+void dbin2deca(double* in,int size,double* out)
+{
+ int i=0;
+ for(i=0;i<size;i++)
+ {
+ out[i]=dbin2decs(in[i]);
+ }
+}
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c
new file mode 100644
index 00000000..ff363c37
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <string.h>
+#include "bin2dec.h"
+#include <stdlib.h>
+#include <stdio.h>
+long double dbin2decs(long double in)
+{
+ int base=1, rem=0;
+ long double out=0.0;
+ int in1;
+ in1=(int)in;
+ while (in1 != 0)
+ {
+ rem = in1 % 10;
+ out = out + (rem * base);
+ in1 = in1 / 10 ;
+ base = base * 2;
+ }
+ return out;
+ // printf("Decimal equivalent is: %f \n",out);
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c
new file mode 100644
index 00000000..8511df92
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include "bin2dec.h"
+
+void i16bin2deca(int16* in,int size,int16* out)
+{
+ int i=0;
+ for(i=0;i<size;i++)
+ {
+ out[i]=i16bin2decs(in[i]);
+ }
+}
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c
new file mode 100644
index 00000000..9aa3be9b
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <string.h>
+#include "bin2dec.h"
+#include <stdlib.h>
+#include <stdio.h>
+int16 i16bin2decs(int16 in)
+{
+ int base=1, rem=0;
+ int16 out=0;
+ int in1;
+ in1=(int)in;
+ while (in1 != 0)
+ {
+ rem = in1 % 10;
+ out = out + (rem * base);
+ in1 = in1 / 10 ;
+ base = base * 2;
+ }
+ return out;
+ // printf("Decimal equivalent is: %f \n",out);
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c
new file mode 100644
index 00000000..c923ffb0
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include "bin2dec.h"
+
+void i8bin2deca(int8* in,int size,int8* out)
+{
+ int i=0;
+ for(i=0;i<size;i++)
+ {
+ out[i]=i8bin2decs(in[i]);
+ }
+}
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c
new file mode 100644
index 00000000..abd3b894
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <string.h>
+#include "bin2dec.h"
+#include <stdlib.h>
+#include <stdio.h>
+int8 i8bin2decs(int8 in)
+{
+ int base=1, rem=0;
+ int8 out=0;
+ int in1;
+ in1=(int)in;
+ while (in1 != 0)
+ {
+ rem = in1 % 10;
+ out = out + (rem * base);
+ in1 = in1 / 10 ;
+ base = base * 2;
+ }
+ return out;
+ // printf("Decimal equivalent is: %f \n",out);
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c
new file mode 100644
index 00000000..b6b75d71
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include "bin2dec.h"
+
+void u16bin2deca(uint16* in,int size,uint16* out)
+{
+ int i=0;
+ for(i=0;i<size;i++)
+ {
+ out[i]=u16bin2decs(in[i]);
+ }
+}
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c
new file mode 100644
index 00000000..cb45a201
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <string.h>
+#include "bin2dec.h"
+#include <stdlib.h>
+#include <stdio.h>
+uint16 u16bin2decs(uint16 in)
+{
+ int base=1, rem=0;
+ uint16 out=0;
+ int in1;
+ in1=(int)in;
+ while (in1 != 0)
+ {
+ rem = in1 % 10;
+ out = out + (rem * base);
+ in1 = in1 / 10 ;
+ base = base * 2;
+ }
+ return out;
+ // printf("Decimal equivalent is: %f \n",out);
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c
new file mode 100644
index 00000000..10461cad
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include "bin2dec.h"
+
+void u8bin2deca(uint8* in,int size,uint8* out)
+{
+ int i=0;
+ for(i=0;i<size;i++)
+ {
+ out[i]=u8bin2decs(in[i]);
+ }
+}
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c
new file mode 100644
index 00000000..0a0f5c40
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2017 - 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <string.h>
+#include "bin2dec.h"
+#include <stdlib.h>
+#include <stdio.h>
+uint8 u8bin2decs(uint8 in)
+{
+ int base=1, rem=0;
+ uint8 out=0;
+ int in1;
+ in1=(int)in;
+ while (in1 != 0)
+ {
+ rem = in1 % 10;
+ out = out + (rem * base);
+ in1 = in1 / 10 ;
+ base = base * 2;
+ }
+ return out;
+ // printf("Decimal equivalent is: %f \n",out);
+}
+