Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Least significant byte of an int
Message
From
30/09/2005 17:46:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01055093
Message ID:
01055116
Views:
13
>>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform