From 1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f 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/dec2bin/i16dec2bins.c | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c (limited to 'src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c') diff --git a/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c b/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c new file mode 100644 index 0000000..0b06aef --- /dev/null +++ b/src/c/elementaryFunctions/radix_conversions/dec2bin/i16dec2bins.c @@ -0,0 +1,32 @@ +#include +#include "dec2bin.h" +#include +void i16dec2bins(int16 in,int n,int16* out) +{ + int quotient,i=0,j=0,tmp=0; + quotient=(int)in; + while(quotient!=0) + { + out[i++]= quotient%2; + quotient=quotient/2; + } + if(n>i-1) + { + for(j=i;j<=n;j++) + out[j]=0.0; + } + if(n==0) + j=i-1; + else + j=n-1; + i=0; + + while(i