Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- // 0xffff
- // hex system 0..9, a - 10 b - 11 c -12 d -13 e -14 f -15
- // ff -> f * 16 ^ 0 + f * 16 ^ 1 = 15 + 240 = 255
- //uint8_t byte{0x1a}; // 16^0 * a + 16^1 * 1 = 1 * 10 + 16 * 1 = 10 + 16 = 26
- //uint8_t byte{ 0b1111 }; // (1 * 2 ^ 0) + (1 * 2 ^ 1) + (1 * 2 ^ 2) + (1 * 2 ^ 3) = 1 * 1 + 1 * 2 + 1 * 4 + 1 * 8 = 15
- // ~ - bitwise NOT - unary op
- // << - bitwise shift left - binary op
- // >> - bitwise shift right - binary op
- // | - bitwise OR - binary op
- // & - bitwise AND - binary op
- // ^ - bitwise XOR - binary op
- // <<= a = a << 1 -> a <<= 1
- // >>= a = a >> 4 -> a >>= 4
- // |= a = a | b -> a |= b
- // &= a = a & 0b0101 -> a &= 0b0101
- // ^= a = a ^ 42 -> a ^= 42
- // /4
- uint8_t ip1{ 0b01100111 };
- uint8_t ip2{ 0b01101101 };
- uint8_t ip3{ 0b10100111 };
- uint8_t ip4{ 0b01101110 };
- uint8_t mask{ 0b11110000 };
- uint8_t host;
- uint8_t net;
- uint8_t byte{ 0b1010 }; // 0b00000000
- uint8_t mask{ 0b0110 };
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment