diff options
Diffstat (limited to '2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec')
10 files changed, 155 insertions, 0 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c new file mode 100644 index 00000000..6bb5d00f --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void doct2deca(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=doct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c new file mode 100644 index 00000000..8f9f0b65 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/doct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +double doct2decs(double in) +{ + int n=0,rem=0, base=1; + double out=0.0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c new file mode 100644 index 00000000..1ab843f8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void i16oct2deca(int16* in,int size,int16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=i16oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c new file mode 100644 index 00000000..ea092852 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i16oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +int16 i16oct2decs(int16 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + int16 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c new file mode 100644 index 00000000..133806ce --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void i8oct2deca(int8* in,int size,int8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=i8oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c new file mode 100644 index 00000000..1886739a --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/i8oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +int8 i8oct2decs(int8 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + int8 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c new file mode 100644 index 00000000..cec3a219 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void u16oct2deca(uint16* in,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=u16oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c new file mode 100644 index 00000000..43dd0ac0 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u16oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +uint16 u16oct2decs(uint16 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + uint16 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c new file mode 100644 index 00000000..3b356587 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2deca.c @@ -0,0 +1,10 @@ +#include "oct2dec.h" + +void u8oct2deca(uint8* in,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i]=u8oct2decs(in[i]); + } +} diff --git a/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c new file mode 100644 index 00000000..c854bc25 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/radix_conversions/oct2dec/u8oct2decs.c @@ -0,0 +1,21 @@ +#include <string.h> +#include "oct2dec.h" +#include <stdio.h> +#include <math.h> + +uint8 u8oct2decs(uint8 in) /* Function to convert octal to decimal */ +{ + int n=0,rem=0, base=1; + uint8 out=0; + n=(int)in; + while (n!=0) + { + rem = n%10; + out = out + (rem * base); + n = n / 10 ; + base = base * 8; + } + return out; +} + + |