- BITAND Function
- BITOR Function
- BITXOR Function
- BITNOT Function
- BITSHIFT_LEFT Function
- BITSHIFT_RIGHT Function
The function signature is similar to bitand
The arguments must be in the range -(2^(32-1)) .. ((2^(32-1))-1). If an
argument is out of this range, the result is undefined.
function bitand(
p_x in binary_integer,
p_y in binary_integer)
return binary_integer
deterministic
Name | Description |
---|---|
p_x |
binary_integer |
p_y |
binary_integer |
return | binary_integer |
select oos_util_bit.bitand(1,3)
from dual;
OOS_UTIL_BIT.BITAND(1,3)
------------------------
1
Copied from http://www.orafaq.com/wiki/Bit
The function signature is similar to bitand
The arguments must be in the range -(2^(32-1)) .. ((2^(32-1))-1). If an
argument is out of this range, the result is undefined.
function bitor(
p_x in binary_integer,
p_y in binary_integer)
return binary_integer
deterministic
Name | Description |
---|---|
p_x |
binary_integer |
p_y |
binary_integer |
return | binary_integer |
select oos_util_bit.bitor(1,3)
from dual;
OOS_UTIL_BIT.BITOR(1,3)
-----------------------
3
Copied from http://www.orafaq.com/wiki/Bit
The function signature is similar to bitand
The arguments must be in the range -(2^(32-1)) .. ((2^(32-1))-1). If an
argument is out of this range, the result is undefined.
function bitxor(
p_x in binary_integer,
p_y in binary_integer)
return binary_integer
deterministic
Name | Description |
---|---|
p_x |
binary_integer |
p_y |
binary_integer |
return | binary_integer |
select oos_util_bit.bitxor(1,3)
from dual;
OOS_UTIL_BIT.BITXOR(1,3)
------------------------
2
Copied from http://www.orafaq.com/wiki/Bit
The function signature is similar to bitand
The arguments must be in the range -(2^(32-1)) .. ((2^(32-1))-1). If an
argument is out of this range, the result is undefined.
function bitnot(
p_x in binary_integer)
return binary_integer
deterministic
Name | Description |
---|---|
p_x |
binary_integer |
return | binary_integer |
select oos_util_bit.bitnot(7)
from dual;
OOS_UTIL_BIT.BITNOT(7)
----------------------
-8
From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Left_shift: This operator shifts the first operand the specified number of bits to the left. Excess bits shifted off to the left are discarded. Zero bits are shifted in from the right.
function bitshift_left(
p_x binary_integer,
p_y binary_integer)
return binary_integer
deterministic
Name | Description |
---|---|
p_x |
binary_integer |
p_y |
binary_integer |
return | binary_integer |
select oos_util_bit.bitshift_left(7, 4)
from dual;
OOS_UTIL_BIT.BITSHIFT_LEFT(7,4)
112
-- In binary terms this converted 111 (7) to 1110000 (112)
From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Right_shift: This operator shifts the first operand the specified number of bits to the right. Excess bits shifted off to the right are discarded. Copies of the leftmost bit are shifted in from the left. Since the new leftmost bit has the same value as the previous leftmost bit, the sign bit (the leftmost bit) does not change. Hence the name "sign-propagating".
function bitshift_right(
p_x binary_integer,
p_y binary_integer)
return binary_integer
deterministic
Name | Description |
---|---|
p_x |
binary_integer |
p_y |
binary_integer |
return | binary_integer |
select oos_util_bit.bitshift_right(7, 1)
from dual;
OOS_UTIL_BIT.BITSHIFT_RIGHT(7,1)
3
-- In binary terms this converted 111 (7) to 011 (3)