olgierd

Untitled

Dec 13th, 2018
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. typedef union {
  2. unsigned char BYTE;
  3. struct {
  4. unsigned char a : 2;
  5. unsigned char b : 3;
  6. unsigned char c : 3;
  7. }bits;
  8. }un_X;
  9.  
  10. un_X x;
  11.  
  12. x.BYTE = 0xAF; // 175(dec)
  13. ///UNIE
  14. // a.bits.b = a.bits.a ^ 3;
  15. //a.bits.c = a.bits.a^3;
  16. bitset<8> wynik(x.BYTE);
  17. cout << wynik << endl;
  18. unsigned char wynik2;
  19. _asm {
  20. mov al, x.bits
  21. and al, 0x03
  22. xor al, 0x03
  23. mov bl, al
  24. shl al, 3
  25. and al, 0x18
  26. shl bl, 5
  27. and bl, 0x60
  28. or al, bl
  29. or x.bits, al
  30. mov wynik2, al
  31. }
  32. bitset<8> eldo(wynik2);
  33. cout << eldo << endl;
RAW Paste Data