Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned short int input;
- {
- short int j,jmax;
- unsigned short int a[32];
- if(input==0)
- {
- for(j=7;j>=0;j--)
- {
- octet1[j]=0;
- octet2[j]=0;
- octet3[j]=0;
- octet4[j]=0;
- }
- return;
- }
- j=0;
- while(input > 0)
- {
- a[j++]=(input%2);
- input=(input/2);
- jmax=j;
- }
- for(j=jmax;j<=31;j++) a[j]=0;
- for(j=31;j>=24;j--) octet4[j-24]=a[j];
- for(j=23;j>=16;j--) octet3[j-16]=a[j];
- for(j=15;j>=8;j--) octet2[j-8]=a[j];
- for(j=7;j>=0;j--) octet1[j]=a[j];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement