1static char * dec2binWzerofill(unsigned long Dec, unsigned int bitLength){
2static char bin[64];
3unsigned int i=0;
45
while (Dec > 0) {
6bin[32+i++] = (Dec & 1 > 0) ? '1' : '0';
7Dec = Dec >> 1;
8}
910
for (unsigned int j = 0; j< bitLength; j++) {
11if (j >= bitLength - i) {
12bin[j] = bin[ 31 + i - (j - (bitLength - i)) ];
13}else {
14bin[j] = '0';
15}
16}
17bin[bitLength] = '\0';
1819
return bin;
20}