Guest User

Untitled

a guest
Jul 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. typedef unsigned char u8;
  2. typedef unsigned short u16;
  3.  
  4. struct u4
  5. {
  6. u8 zero : 4;
  7. u8 value : 4;
  8.  
  9. u4(){}
  10. u4(u8 _value) {
  11. zero = 0;
  12. value = _value;
  13. }
  14. const u4 operator+(const u4& b) { return value + b.value; }
  15. u4 operator+=(const u4& b) { return value + b.value; }
  16. bool operator==(const u4& b) { return value == b.value; }
  17.  
  18. int check_overflow(u8 operand) const { return operand > (0xf - value) ? 1 : 0; }
  19. };
Add Comment
Please, Sign In to add comment