I've just abou finished translating this code to VB.Net. One of the things that stood out to me was this (in bold):
If it's 0xffffu, thats 65535 in decimal or all 1's in binary. If you use the the AND operator, won't it always be cs no matter what cs is?Code:uint cs = 0; for (int i = 0; i < pingCommand.Length; i = i+2) cs += BitConverter.ToUInt16(pingCommand, i); cs = ~((cs & 0xffffu) + (cs >> 16));
The only reason I'm asking is I'm having a rough time translating the bolded snippet. I was wondering if I could replace it with just "cs."




Reply With Quote