From b43eccd4cffed5bd1017c5821524fb6e49202f78 Mon Sep 17 00:00:00 2001 From: Sandeep Gupta Date: Sun, 18 Jun 2017 23:55:40 +0530 Subject: First commit --- .../radix_conversions/bin2dec/dbin2deca.c | 21 ++++++++++++++ .../radix_conversions/bin2dec/dbin2decs.c | 32 ++++++++++++++++++++++ .../radix_conversions/bin2dec/i16bin2deca.c | 21 ++++++++++++++ .../radix_conversions/bin2dec/i16bin2decs.c | 32 ++++++++++++++++++++++ .../radix_conversions/bin2dec/i8bin2deca.c | 21 ++++++++++++++ .../radix_conversions/bin2dec/i8bin2decs.c | 32 ++++++++++++++++++++++ .../radix_conversions/bin2dec/u16bin2deca.c | 21 ++++++++++++++ .../radix_conversions/bin2dec/u16bin2decs.c | 32 ++++++++++++++++++++++ .../radix_conversions/bin2dec/u8bin2deca.c | 21 ++++++++++++++ .../radix_conversions/bin2dec/u8bin2decs.c | 32 ++++++++++++++++++++++ 10 files changed, 265 insertions(+) create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2decs.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2decs.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2decs.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2decs.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c create mode 100644 2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2decs.c (limited to '2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec') 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 +#include "bin2dec.h" +#include +#include +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 +#include "bin2dec.h" +#include +#include +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 +#include "bin2dec.h" +#include +#include +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 +#include "bin2dec.h" +#include +#include +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 +#include "bin2dec.h" +#include +#include +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); +} + -- cgit