我需要将以下函数转换为 VB.NET,但我不确定如何处理该语句
res = (uint)((h * 0x21) + c);
功能齐全:
private static uint convert(string input)
{
uint res = 0;
foreach (int c in input)
res = (uint)((res * 0x21) + c);
return res;
}
我创建了以下内容,但出现溢出错误:
Private Shared Function convert(ByVal input As String) As UInteger
Dim res As UInteger = 0
For Each c In input
res = CUInt((res * &H21) + Asc(c)) ' also tried AscW
Next
Return res
End Function
我错过了什么?有人可以解释一下细节吗?