|
@@ -53,38 +53,34 @@ type
|
|
|
|
|
|
{ ==================================================================== }
|
|
|
|
|
|
- class function ToBoolean(value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ class function ToBoolean(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
: Boolean; static; inline;
|
|
|
- class function ToChar(value: THashLibByteArray; StartIndex: Int32): Char;
|
|
|
- static; inline;
|
|
|
- class function ToDouble(value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ class function ToChar(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : Char; static; inline;
|
|
|
+ class function ToDouble(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
: Double; static; inline;
|
|
|
- class function ToInt16(value: THashLibByteArray; StartIndex: Int32): Int16;
|
|
|
- static; inline;
|
|
|
- class function ToInt32(value: THashLibByteArray; StartIndex: Int32): Int32;
|
|
|
- static; inline;
|
|
|
- class function ToInt64(value: THashLibByteArray; StartIndex: Int32): Int64;
|
|
|
- static; inline;
|
|
|
- class function ToSingle(value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ class function ToInt16(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : Int16; static; inline;
|
|
|
+ class function ToInt32(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : Int32; static; inline;
|
|
|
+ class function ToInt64(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : Int64; static; inline;
|
|
|
+ class function ToSingle(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
: Single; static; inline;
|
|
|
- class function ToString(value: THashLibByteArray): String; reintroduce;
|
|
|
- overload; static;
|
|
|
- class function ToString(value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ class function ToString(const value: THashLibByteArray): String;
|
|
|
+ reintroduce; overload; static;
|
|
|
+ class function ToString(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
: String; reintroduce; overload; static;
|
|
|
- class function ToString(value: THashLibByteArray;
|
|
|
+ class function ToString(const value: THashLibByteArray;
|
|
|
StartIndex, &Length: Int32): String; reintroduce; overload; static;
|
|
|
- class function ToUInt8(value: THashLibByteArray; StartIndex: Int32): UInt8;
|
|
|
- static; inline;
|
|
|
- class function ToUInt16(value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ class function ToUInt8(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : UInt8; static; inline;
|
|
|
+ class function ToUInt16(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
: UInt16; static; inline;
|
|
|
- class function ToUInt32(value: THashLibByteArray; StartIndex: Int32)
|
|
|
- : UInt32; overload; static; inline;
|
|
|
- class function ToUInt32(value: PByte; StartIndex: Int32): UInt32; overload;
|
|
|
- static; inline;
|
|
|
- class function ToUInt64(value: THashLibByteArray; StartIndex: Int32)
|
|
|
- : UInt64; overload; static; inline;
|
|
|
- class function ToUInt64(value: PByte; StartIndex: Int32): UInt64; overload;
|
|
|
- static; inline;
|
|
|
+ class function ToUInt32(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : UInt32; static; inline;
|
|
|
+ class function ToUInt64(const value: THashLibByteArray; StartIndex: Int32)
|
|
|
+ : UInt64; static; inline;
|
|
|
|
|
|
end;
|
|
|
|
|
@@ -224,7 +220,7 @@ end;
|
|
|
|
|
|
{ ==================================================================== }
|
|
|
|
|
|
-class function TBitConverter.ToBoolean(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToBoolean(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Boolean;
|
|
|
begin
|
|
|
// result := PBoolean(@value[StartIndex])^;
|
|
@@ -232,7 +228,7 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToChar(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToChar(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Char;
|
|
|
begin
|
|
|
// System.Move(value[StartIndex], result, System.SizeOf(result));
|
|
@@ -251,7 +247,7 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToDouble(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToDouble(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Double;
|
|
|
var
|
|
|
i1, i2: Int32;
|
|
@@ -283,7 +279,7 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToInt16(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToInt16(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Int16;
|
|
|
begin
|
|
|
|
|
@@ -303,7 +299,7 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToInt32(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToInt32(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Int32;
|
|
|
begin
|
|
|
// System.Move(value[StartIndex], result, System.SizeOf(result));
|
|
@@ -324,7 +320,7 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToInt64(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToInt64(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Int64;
|
|
|
var
|
|
|
i1, i2: Int32;
|
|
@@ -351,7 +347,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToSingle(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToSingle(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): Single;
|
|
|
var
|
|
|
val: Int32;
|
|
@@ -374,7 +370,7 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToString(value: THashLibByteArray): String;
|
|
|
+class function TBitConverter.ToString(const value: THashLibByteArray): String;
|
|
|
var
|
|
|
LowVal: Int32;
|
|
|
begin
|
|
@@ -387,13 +383,13 @@ begin
|
|
|
result := ToString(value, LowVal);
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToString(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToString(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): String;
|
|
|
begin
|
|
|
result := ToString(value, StartIndex, System.Length(value) - StartIndex);
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToString(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToString(const value: THashLibByteArray;
|
|
|
StartIndex, &Length: Int32): String;
|
|
|
|
|
|
var
|
|
@@ -432,14 +428,14 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToUInt8(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToUInt8(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): UInt8;
|
|
|
begin
|
|
|
// result := PByte(@value[StartIndex])^;
|
|
|
System.Move(value[StartIndex], result, System.SizeOf(result));
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToUInt16(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToUInt16(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): UInt16;
|
|
|
begin
|
|
|
// System.Move(value[StartIndex], result, System.SizeOf(result));
|
|
@@ -457,7 +453,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToUInt32(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToUInt32(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): UInt32;
|
|
|
begin
|
|
|
// System.Move(value[StartIndex], result, System.SizeOf(result));
|
|
@@ -478,27 +474,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToUInt32(value: PByte; StartIndex: Int32): UInt32;
|
|
|
-begin
|
|
|
-
|
|
|
- if (IsLittleEndian) then
|
|
|
- begin
|
|
|
- result := UInt32(value[StartIndex] or (value[StartIndex + 1] shl 8) or
|
|
|
- (value[StartIndex + 2] shl 16) or (value[StartIndex + 3] shl 24));
|
|
|
- Exit;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
-
|
|
|
- result := UInt32((value[StartIndex] shl 24) or
|
|
|
- (value[StartIndex + 1] shl 16) or (value[StartIndex + 2] shl 8) or
|
|
|
- (value[StartIndex + 3]));
|
|
|
- Exit;
|
|
|
- end;
|
|
|
-
|
|
|
-end;
|
|
|
-
|
|
|
-class function TBitConverter.ToUInt64(value: THashLibByteArray;
|
|
|
+class function TBitConverter.ToUInt64(const value: THashLibByteArray;
|
|
|
StartIndex: Int32): UInt64;
|
|
|
var
|
|
|
i1, i2: Int32;
|
|
@@ -528,31 +504,4 @@ begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
-class function TBitConverter.ToUInt64(value: PByte; StartIndex: Int32): UInt64;
|
|
|
-var
|
|
|
- i1, i2: Int32;
|
|
|
-begin
|
|
|
-
|
|
|
- if (IsLittleEndian) then
|
|
|
- begin
|
|
|
- i1 := value[StartIndex] or (value[StartIndex + 1] shl 8) or
|
|
|
- (value[StartIndex + 2] shl 16) or (value[StartIndex + 3] shl 24);
|
|
|
- i2 := (value[StartIndex + 4]) or (value[StartIndex + 5] shl 8) or
|
|
|
- (value[StartIndex + 6] shl 16) or (value[StartIndex + 7] shl 24);
|
|
|
- result := UInt64(UInt32(i1) or (Int64(i2) shl 32));
|
|
|
- Exit;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
-
|
|
|
- i1 := (value[StartIndex] shl 24) or (value[StartIndex + 1] shl 16) or
|
|
|
- (value[StartIndex + 2] shl 8) or (value[StartIndex + 3]);
|
|
|
- i2 := (value[StartIndex + 4] shl 24) or (value[StartIndex + 5] shl 16) or
|
|
|
- (value[StartIndex + 6] shl 8) or (value[StartIndex + 7]);
|
|
|
- result := UInt64(UInt32(i2) or (Int64(i1) shl 32));
|
|
|
- Exit;
|
|
|
- end;
|
|
|
-
|
|
|
-end;
|
|
|
-
|
|
|
end.
|