extracting_junior_nibble
Этот коммит содержится в:
@@ -3,6 +3,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
//char nibble_to_hex(uint8_t i)
|
||||
char nibble_to_hex(uint8_t i) //Conversion to hex format
|
||||
{
|
||||
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()
|
||||
@@ -40,6 +44,9 @@ int main()
|
||||
assert(nibble_to_hex(0xe) == 'e');
|
||||
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... ";
|
||||
cin.get();
|
||||
|
||||
Ссылка в новой задаче
Block a user