fork(1) download
  1. /* Shao Miller - 2012-Oct-13 */
  2.  
  3. #include <stdio.h>
  4.  
  5. int main(void) {
  6. register unsigned char shift;
  7. register unsigned char * pos;
  8. unsigned char stream[] = { 1, 2, 3, 4 };
  9. register unsigned char * end;
  10.  
  11. printf("Lowest-bit first: ");
  12.  
  13. for (
  14. (shift = 1), (pos = stream), (end = stream + sizeof stream);
  15. pos < end;
  16. (shift <<= 1) ? 0 : (pos += ++shift)
  17. ) {
  18. printf((shift & *pos) ? "1" : "0");
  19. }
  20.  
  21. printf("\n");
  22.  
  23. printf("Lowest-bit first: ");
  24.  
  25. shift = 1;
  26. pos = stream;
  27. end = stream + sizeof stream;
  28. while (pos < end) {
  29. printf((shift & *pos) ? "1" : "0");
  30. if (!(shift <<= 1))
  31. pos += ++shift;
  32. }
  33.  
  34. printf("\n");
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
Lowest-bit first: 10000000010000001100000000100000
Lowest-bit first: 10000000010000001100000000100000