HowTo: 2's Complement sum checksum?
-
Can someone explain to me how to perform this function in VB.Net? A more detailed description can be found at http://www.netfor2.com/checksum.html I need to perform a 2's complement sum CheckSum on some data before sending it to a serial device and when recieving data from the device. Thanks for any help. ================================= When i was in school all I wanted was to get out into the real world. Now that I'm in the real world all I want is to go back to school.
-
Can someone explain to me how to perform this function in VB.Net? A more detailed description can be found at http://www.netfor2.com/checksum.html I need to perform a 2's complement sum CheckSum on some data before sending it to a serial device and when recieving data from the device. Thanks for any help. ================================= When i was in school all I wanted was to get out into the real world. Now that I'm in the real world all I want is to go back to school.
-
Can someone explain to me how to perform this function in VB.Net? A more detailed description can be found at http://www.netfor2.com/checksum.html I need to perform a 2's complement sum CheckSum on some data before sending it to a serial device and when recieving data from the device. Thanks for any help. ================================= When i was in school all I wanted was to get out into the real world. Now that I'm in the real world all I want is to go back to school.
My previous really gives a ones compliment -- not really what you asked for. In order to perform a twos compliment I prsonaklly would revert to tyhe interoperability of the .NET languages and write it in C++, then like it to Visual Basic. If you decide to try that, start a Visual C++ .NET Class library. then add the following code to the file that holds the name you gave the library, compile and link to it. NOTE that the code given works only with 32-bit integers, a similar thing sould be done for larger or smaller integers. int TwoCompl(int val) { __asm { mov eax, val not eax mov val, eax }; return val; }