Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
dhar1
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//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; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,93 sec, absolute running time: 0,34 sec, absolute service time: 2,28 sec
edit mode
|
history
|
discussion