From 61b559e73fde034df9edc7a5b9a3c1fdc9cbc13a Mon Sep 17 00:00:00 2001 From: KleptsovKD Date: Mon, 3 Feb 2025 20:50:55 +0300 Subject: [PATCH] extracting_senior_nibble --- lab04/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lab04/main.cpp b/lab04/main.cpp index 9934cd3..b99e826 100644 --- a/lab04/main.cpp +++ b/lab04/main.cpp @@ -23,6 +23,12 @@ uint8_t jun_nibble(uint8_t i) //Extracting the junior Nibble return i & 0x0f; } +uint8_t sen_nibble(uint8_t i) //Extracting the senior Nibble +{ + return (i & 0xf0) >> 4; +} + + int main() { @@ -47,6 +53,7 @@ int main() 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 << "Senior nibble: " << hex << +sen_nibble(0xce) << endl; //senior nibble cout << "Press any key for exit... "; cin.get();