Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. unsigned short int input;
  2. {
  3. short int j,jmax;
  4. unsigned short int a[32];
  5. if(input==0)
  6. {
  7. for(j=7;j>=0;j--)
  8. {
  9. octet1[j]=0;
  10. octet2[j]=0;
  11. octet3[j]=0;
  12. octet4[j]=0;
  13. }
  14. return;
  15. }
  16. j=0;
  17. while(input > 0)
  18. {
  19. a[j++]=(input%2);
  20. input=(input/2);
  21. jmax=j;
  22. }
  23. for(j=jmax;j<=31;j++) a[j]=0;
  24. for(j=31;j>=24;j--) octet4[j-24]=a[j];
  25. for(j=23;j>=16;j--) octet3[j-16]=a[j];
  26. for(j=15;j>=8;j--) octet2[j-8]=a[j];
  27. for(j=7;j>=0;j--) octet1[j]=a[j];
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement