Core.Terms.EncodeInteger
Jump to navigation
Jump to search
Contents
Classification
Name | EncodeInteger |
Short Description | Returns a ByteField which contains the encoded value of the original Integer argument. |
Class | Term |
Extension | OTX Core library |
Group | Integer conversion terms |
Exceptions | OutOfBoundsException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
ByteFieldTerm = Conversion.EncodeInteger(EncodingType, Endianness, IntegerTerm);
Description
EncodeInteger term returns a ByteField which contains the encoded value of the original Integer argument. For the encoding, n-bit unsigned, n-bit signed-binary or n-bit two's complement representation of the integer can be chosen, where be chosen out of 8, 16, 32 and 64bit. The term also provides control over the byte order which be used for encoding.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
ByteField | The decoded ByteField value of the Integer argument |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
EncodingType | EncodingType | Value | @EncodingType:64-BIT | [1] | Specifies how the Integer value be encoded. EncodingType = {UNSIGNED|SIGNED-BINARY|TWOS-COMPLEMENT} |
EncodingSize | EncodingSize | Value | @EncodingSize:64-BIT | [1] | Specifies how many bits will be used for the encoding. EncodingSize = {8-BIT|16-BIT|32-BIT|64-BIT} |
ByteOrder | Endianness | Value | @Endianness:LITTLE-ENDIAN | [1] | Specifies the byte order which will be used when writing the encoded Integervalue into the resulting ByteField. Endianness = {LITTE-ENDIAN|MIXED-ENDIAN|BIG-ENDIAN}. LITTLE-ENDIAN is the default value. |
Integer | Integer | Term | - | [1] | Represents the Integer value which be converted to ByteField. |
Examples
ByteField result;
result = EncodeInteger(@EncodingType:TWOSCOMPLEMENT, @EncodingSize:16BIT, @Endianness:LITTLEENDIAN, -256);
//Returns the result = 00 FF