What I am asking is if it is possible to join all bits in 2 different numbers.
A pseudo-code example:
bytes=array(0x04, 0x3F);
//place bitwise black magic here
print 0x043F;
Another example:
bytes=array(0xFF, 0xFFFF);
//place bitwise black magic here
print 0xFFFFFF;
Yet another example:
bytes=array(0x34F3, 0x54FD);
//place bitwise black magic here
print 0x34F354FD;
I want to restrict this to only and only bitwise operators (>>
, <<
, |
, ^
, ~
and &
).
This should work at least in PHP and Javascript.
Is this possible in ANY way?
If I'm not being clear, please ask your doubts in a comment.
If I understand your question correctly,
This should be the answer in php:
Update: instead of + use the | operator