The following answer is not agnostic, and my wording is based on a small end format ...
You can shift bits by simply multiplying (left shift) or dividing (shift right) the argument by 2 by the power x, where x is the number of bits shifted. for example, if I need to shift the low byte of a number (255: 11111111) 16 bits to the left, I would do the following operation:
select 255 * power(2,16) from dual;
on the contrary, if I want to shift the value 16711680 by 16 bits to the right, I would do the following:
select 16711680 / power(2,16) from dual;
Tim lowes
source share