Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. int lightCount = 1, decalCount = 22, probeCount = 33, extraNumber = 10;
  2.     unsigned float myCount = 0;
  3.     myCount |= probeCount;
  4.     myCount <<= 8;
  5.     myCount |= decalCount;
  6.     myCount <<= 8;
  7.     myCount |= lightCount;
  8.     myCount <<= 8;
  9.     myCount |= extraNumber;
  10.     byte *myCounts = new byte[4];
  11.     myCounts[0] = myCount >> 0; // 1
  12.     myCounts[1] = myCount >> 8; //22
  13.     myCounts[2] = myCount >> 16; //33
  14.     myCounts[3] = myCount >> 24; //10
  15.  
  16.     for (int i = 0; i < 4; i++) {
  17.         std::cout << "NUM "<<i <<" : " << (int)myCounts[i] << "\n";
  18.         //prints 1 then 22 then 33 then 10
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement