public static UInt32[] ToUInt32Array(string input, Boolean IncludeLength)
{ Byte[] Data=System.Text.Encoding.UTF8.GetBytes(input);
Int32 n = (((Data.Length & 3) == 0) ? (Data.Length >> 2) : ((Data.Length >> 2) + 1));
UInt32[] Result;
if (IncludeLength)
{
Result = new UInt32[n + 1];
Result[n] = (UInt32)Data.Length;
}
else
{
Result = new UInt32[n];
}
n = Data.Length;
for (Int32 i = 0; i < n; i++)
{
Result[i >> 2] |= (UInt32)Data[i] << ((i & 3) << 3);
}
return Result;
}
{ Byte[] Data=System.Text.Encoding.UTF8.GetBytes(input);
Int32 n = (((Data.Length & 3) == 0) ? (Data.Length >> 2) : ((Data.Length >> 2) + 1));
UInt32[] Result;
if (IncludeLength)
{
Result = new UInt32[n + 1];
Result[n] = (UInt32)Data.Length;
}
else
{
Result = new UInt32[n];
}
n = Data.Length;
for (Int32 i = 0; i < n; i++)
{
Result[i >> 2] |= (UInt32)Data[i] << ((i & 3) << 3);
}
return Result;
}
解决方案 »
- delphi7+sql2000个人版做好后,如何放在服务器上
- tabsheet打开和关闭事件的疑问,求助论坛里的朋友们。
- 马上就能脱掉马甲了散点分!
- batchmove(parodox转化mysql)的问题
- 请问如何设置button和 BitBtn 控件的背景色 ??????????????????
- 多次调用的函数内的局部变量是否会重复消耗资源?
- Delphi控件的事件有判断鼠标离开或是失去焦点的吗?(初学者拜上)
- 如何在DBGRID中实现QUERY到的相同的字段值合并而不同的字段值原样输出。
- 很简单的一个问题,但我不知我忽略了什么?
- 各位用Access做后端时,使用什么前端?
- 我想Borland自己是不用Together for Delphi的!!!
- 100分! 求多文档绘画程序的撒消和重做实现方法!
type
UWArray = array of LongWord;
var
n, i: Integer;
begin
n := (Length(input) + 3) shr 2;
if IncludeLength then
begin
GetMem(Result, (n + 1) * Sizeof(LongWord));
UWArray(Result)[n] := Length(input);
end else
GetMem(Result, n * Sizeof(LongWord));
n := Length(input) - 1;
for i := 0 to n do
UWArray(Result)[I shr 2] := UWArray(Result)[I shr 2] or ((LongWord(Ord(input[i + 1])) shl ((i and 3) shl 3)));
end;
UWArray = array of LongWord;function ToUInt32Array(input: string; IncludeLength: Boolean): UWArray;
var
n, i: Integer;
begin
n := (Length(input) + 3) shr 2;
if IncludeLength then
begin
SetLength(Result, n + 1);
Result[n] := Length(input);
end else
SetLength(Result, n);
n := Length(input) - 1;
for i := 0 to n do
Result[I shr 2] :=Result[I shr 2] or ((LongWord(Ord(input[i + 1])) shl ((i and 3) shl 3)));
end;