Topic Path: Symbol Reference > Functions > BytesToInt64 Function
ContentsIndexHome
PreviousUpNext
BytesToInt64 Function

Converts byte values to a 64-bit integer data type.

File
function BytesToInt64(
    const AValue: TIdBytes; 
    const AIndex: Integer = 0
): Int64;
Parameters 
Description 
AValue 
Value to convert to a 64-bit integer.
 
AIndex 
Initial position in the array of bytes to use when converting bytes value to the ordinal data type. Default value is 0. 

Int64 - 64-bit integer for the specified value.

BytesToInt64 is an Int64 function used to convert byte values specified in AValue to a 64-bit integer data type. 

AIndex is a zero-based offset into the array of bytes to use when converting byte values to the ordinal data type. 

Please note that AValue must have an allocated size large enough to store the ordinal data type beginning at the offset indicated in AIndex. When AValue is too small, an EAssertionFailed exception will be raised and the return value for the function is 0 (zero). 

 

For the .Net platform, BytesToInt64 calls the ToInt64 method from the FCL System.BitConverter class to convert the byte values at the specified offset in AValue to a 64-bit integer data type. 

 

For all other platforms where pointer operations are supported, BytesToInt64 casts and de-references a pointer for the ordinal data type using the byte values at the specified offset into the array of bytes. 

Use BytesToCardinal, BytesToInteger, BytesToShort, or BytesToWord to convert a sequence of bytes to the desired numeric data type.

Exceptions 
Description 
EAssertionFailed 
Raised when the array of bytes is too small to store all bytes required to represent the ordinal data type at the indicated offset into the array of bytes. 
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.