Reference Guide > TDV Support for SQL Functions > TDV-Supported Binary Functions
 
TDV-Supported Binary Functions
TDV supports a family of binary functions that perform bitwise logic on signed integers of length 1, 2, 4, and 8 bytes.
Name
SQL Name
Length (bits)
Minimum
Maximum
INT1
TINYINT
8
-128
127
INT2
SMALLINT
16
-32,768
32,767
INT4
INTEGER
32
-2,147,483,648
2,147,483,647
INT8
BIGINT
64
-9,223,312,036,854,776
9,223,312,036,854,775
For these functions, TDV represents values as signed integers. The leftmost bit has a value of -128; it has the dual role of designating 128 and the negative sign. All of the other bits have their customary positive value.
To determine the arithmetic value of an integer in this notation, add the values of all of the bits, with their signs:
1000 0000 is -128
1000 0001 is -127 (1x-128 + 1x1)
1111 1110 is -2 (1x-128 + 1x64 + 1x32 + 1x16 + 1x8 + 1x4 + 1x2)
TDV supports the binary functions listed in the table.
TDV-Supported Binary Function
Comments
INT1AND, INT2AND, INT4AND, INT8AND
INT1NOT, INT2NOT, INT4NOT, INT8NOT
INT1OR, INT2OR, INT4OR, INT8OR
INT1SHL, INT2SHL, INT4SHL, INT8SHL
INT1SHR, INT2SHR, INT4SHR, INT8SHR
INT1XOR, INT2XOR, INT4XOR, INT8XOR