Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very big value for CRC32
Message
De
13/08/2011 05:27:19
 
 
À
12/08/2011 13:25:22
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01520761
Message ID:
01520911
Vues:
48
>>If you use UInt32 as storage for the calculation then, by definition, it can exceed the maximum value of an Int32. But this is irrelevant. If you need to compare the calculated CRC value to one already stored in SQL server then simply use the matching .NET type for the calculation....
>>
>>.
>> And, even if the property is declared integer, this wouldn't create an overflow. This is why the program didn't generate an error at calculation time. But, it did generate an error at SQL query time as at that location, we have to build our query with the same type as the type in the table.
>
>Thanks

You might get a clearer idea of what is happening by looking at the byte representations e.g.:
Dim unsigned As UInt32 = UInt32.MaxValue - 1111  ' 4294966184
Dim bytes As Byte() = BitConverter.GetBytes(unsigned)     ' 168 251 255 255
Dim signed As Int32 = BitConverter.ToInt32(bytes, 0)          ' -1112
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform