Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Least significant byte of an int
Message
De
30/09/2005 17:46:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01055093
Message ID:
01055116
Vues:
17
>>A division mod 256 should also do the trick.
>
>Hilmar,
>Could you please post code? (My mind left for the weekend again and my body should get out of here soon to otherwise I'll be in some serious trouble with the chief<s>)
>
>I guess the big question is which is faster bitwise AND or your mod 256.
>
>Einar

The idea is to calculate SomeInteger % 256. This will give you the remainder of the division.

I think, however, that the AND approach is more flexible: you can easily get the second-last byte, for example. With the modulus (remainder) that would require a lot more code.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform