KleptsovKD 4 месяцев назад
Родитель e68529c8b0
Сommit 46d10b325c

@ -3,6 +3,7 @@
using namespace std; using namespace std;
//char nibble_to_hex(uint8_t i)
char nibble_to_hex(uint8_t i) //Conversion to hex format char nibble_to_hex(uint8_t i) //Conversion to hex format
{ {
assert(0x0 <= i && i <= 0xf); assert(0x0 <= i && i <= 0xf);
@ -17,7 +18,10 @@ char nibble_to_hex(uint8_t i) //Conversion to hex format
} }
} }
uint8_t jun_nibble(uint8_t i) //Extracting the junior Nibble
{
return i & 0x0f;
}
int main() int main()
@ -40,6 +44,9 @@ int main()
assert(nibble_to_hex(0xe) == 'e'); assert(nibble_to_hex(0xe) == 'e');
assert(nibble_to_hex(0xf) == 'f'); assert(nibble_to_hex(0xf) == 'f');
cout << nibble_to_hex(10) << endl;
//cout << hex << static_cast(jun_nibble(0xce)) << endl;
cout << "Junior nibble: " << hex << +jun_nibble(0xce) << endl; //junior nibble
cout << "Press any key for exit... "; cout << "Press any key for exit... ";
cin.get(); cin.get();

Загрузка…
Отмена
Сохранить