diff options
Diffstat (limited to 'src/c/elementaryFunctions/radix_conversions/dec2oct')
10 files changed, 181 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c new file mode 100644 index 0000000..03fc2dc --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void ddec2octa(double* in,int size,double* out) +{ + int i=0; + for(i=0;i<size;i++) + { ddec2octs(in[i],&(out[i*15])); +} +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c new file mode 100644 index 0000000..d06da30 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void ddec2octs(double in,double* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c new file mode 100644 index 0000000..882b00b --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octa.c @@ -0,0 +1,10 @@ +#include "dec2oct.h" + +void i16dec2octa(int16* in,int size,int16* out) +{ + int i=0; + for(i=0;i<size;i++) + { +i16dec2octs(in[i],&(out[i*15])); +} +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c new file mode 100644 index 0000000..cb08845 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i16dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void i16dec2octs(int16 in,int16* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c new file mode 100644 index 0000000..221f486 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void i8dec2octa(int8* in,int size,int8* out) +{ + int i=0; + for(i=0;i<size;i++) + { i8dec2octs(in[i],&(out[i*15])); +} +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c new file mode 100644 index 0000000..30ae5b0 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/i8dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void i8dec2octs(int8 in,int8* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c new file mode 100644 index 0000000..cc0d543 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void u16dec2octa(uint16* in,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { u16dec2octs(in[i],&(out[i*15])); +} +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c new file mode 100644 index 0000000..4b0bd59 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u16dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void u16dec2octs(uint16 in,uint16* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c new file mode 100644 index 0000000..c187077 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octa.c @@ -0,0 +1,9 @@ +#include "dec2oct.h" + +void u8dec2octa(uint8* in,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { u8dec2octs(in[i],&(out[i*15])); +} +} diff --git a/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c new file mode 100644 index 0000000..9348630 --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2oct/u8dec2octs.c @@ -0,0 +1,27 @@ +#include <string.h> +#include <math.h> +#include "dec2oct.h" +#include <stdio.h> + +void u8dec2octs(uint8 in,uint8* out) +{ + int i=0,j=0,tmp=0; + int quotient; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%8; + quotient=quotient/8; + } + j=i-1; + i=0; + + while(i<j) + { + tmp=out[i]; + out[i]=out[j]; + out[j]=tmp; + i++; + j--; + } +} |