Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. int32_t const_data[11];
  2. int8_t buffer[44];
  3.  
  4. int k = 0;
  5. while (k < 11) {
  6. for (int j = 0; j < 44; j++) {
  7. const_data[k] = bf.buffer[j];
  8. k++;
  9. }
  10. }
  11.  
  12. #include <iostream>
  13.  
  14. int main(){
  15. std::int8_t input[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};
  16. std::int32_t output[10];
  17. int count=0;
  18. for(;count<sizeof(input);count+=sizeof(std::int32_t)/sizeof(std::int8_t)){
  19. output[count] = static_cast<std::int32_t>(*(reinterpret_cast<std::int32_t*>(&input[count])));
  20. std::cout<<std::hex<<static_cast<std::int32_t>(input[count])<<":"<<static_cast<std::int32_t>(output[count])<<std::endl;
  21. }
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement