From b9cfdca438347fe4d28f7caff3cb7b382e455d3a Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Wed, 19 Apr 2017 14:57:49 +0530 Subject: Merged Shamik's work --- .../radix_conversions/bin2dec/dbin2deca.c | 10 ++++++++++ .../radix_conversions/bin2dec/dbin2decs.c | 21 +++++++++++++++++++++ .../radix_conversions/bin2dec/i16bin2deca.c | 10 ++++++++++ .../radix_conversions/bin2dec/i16bin2decs.c | 21 +++++++++++++++++++++ .../radix_conversions/bin2dec/i8bin2deca.c | 10 ++++++++++ .../radix_conversions/bin2dec/i8bin2decs.c | 21 +++++++++++++++++++++ .../radix_conversions/bin2dec/u16bin2deca.c | 10 ++++++++++ .../radix_conversions/bin2dec/u16bin2decs.c | 21 +++++++++++++++++++++ .../radix_conversions/bin2dec/u8bin2deca.c | 10 ++++++++++ .../radix_conversions/bin2dec/u8bin2decs.c | 21 +++++++++++++++++++++ 10 files changed, 155 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..9baf4bda --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/dbin2deca.c @@ -0,0 +1,10 @@ +#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..1ebc973c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i16bin2deca.c @@ -0,0 +1,10 @@ +#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..ad76143e --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/i8bin2deca.c @@ -0,0 +1,10 @@ +#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..2a4ac15d --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u16bin2deca.c @@ -0,0 +1,10 @@ +#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..f775664c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/bin2dec/u8bin2deca.c @@ -0,0 +1,10 @@ +#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