Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very big value for CRC32
Message
De
12/08/2011 04:50:55
 
 
À
11/08/2011 15:57:30
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:
01520807
Vues:
45
>Is this an acceptable value for a CRC32:
>
>3989233970
>
>This value goes higher than the maximum allowed for an integer. So, I thought I would verify first if this is a value we could receive from a CRC32 before adding support for a BigInt in my application.

All that matters is the 32 bit pattern held by the integer. It does not matter whether you use Int32 of UInt32 to hold the value - bitwise operations never cause an overflow.
As long as the types you use for the comparison are the same (i.e. both Int32 or both UInt32) it will work. Actually, in VB.NET I think you can do bitwise operations on a mix of types. e.g:
Dim i As Int32 = 16777215
Dim u As UInt32 = i
Dim Match As Boolean = (i Xor u) = 0
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform