简体   繁体   English

C ++到VB.NET的转换,剩余的<<和>>保留在数学语句中

[英]C++ to VB.NET Conversion with Residual << and >> Remaining in Math Statements

I converted some C++ code to VB.NET but there is residual use of ">>" and "<<" being used during the workflow which is throwing me off. 我将一些C ++代码转换为VB.NET,但在工作流程中使用了“>>”和“<<”,这让我失望。 How can I get rid of the << and >> in the example loops below and rewrite them in VB.NET without << and >>: 如何摆脱下面的示例循环中的<<和>>,并在没有<<和>>的情况下在VB.NET中重写它们:

  For i As UInteger = q + 1 To L
     X(i) = X(i - q) Xor (X(i - q) >> CInt(q))
     For j As UInteger = 1 To q - 1
       X(i) = X(i) Xor (((b >> (q - 1 - j)) And 1) * X(i - j))
     Next j
  Next i

And other uses of << such as: 和其他用途<<如:

  For i As UInteger = 1 To L 
    X(i) = 1 << (32 - i)
  Next i

Mathematically, I don't what C++ is doing with the << and >>. 在数学上,我不知道C ++在使用<<和>>做什么。

They are bit shift operations, and you can leave them. 它们是位移操作,你可以离开它们。 They are the same in VB .NET. 它们在VB .NET中是相同的。

http://msdn.microsoft.com/en-us/library/vstudio/2d9yb87a.aspx http://msdn.microsoft.com/en-us/library/vstudio/2d9yb87a.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM