Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
dhar1
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> using namespace std; int main() { using type = unsigned short; // B00F + 25B0 to get D5BF type left = 0xB00F; type right = 0x25B0; type first = ((left & 0xF000) >> 12) + ((right & 0xF000) >> 12); cout << "first value " << std::hex << first << std::endl; type second = ((left & 0x0F00) >> 8) + ((right & 0x0F00) >> 8); cout << "second value " << std::hex << second << std::endl; type third = ((left & 0x00F0) >> 4) + ((right & 0x00F0) >> 4); cout << "third value " << std::hex << third << std::endl; type fourth = (left & 0x000F) + (right & 0x000F); cout << "4th value " << std::hex << fourth << std::endl; type total = (first << 12) + (second << 8) + (third << 4) + fourth; cout << "total " << std::hex << total << std::endl; }
run
|
edit
|
history
|
help
0
#33
calling convention is part of type(?)
MSVC bug in __fastcall implementation !!!
zero size std::array parameter
PRIx64 on MSVC
hangman
Hangman
Regex pipe and tabs c++
cross-platform sleep function
narrow_cast