Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bit twiddling in C#
Message
De
15/02/2006 12:51:15
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01096485
Message ID:
01096537
Vues:
20
>>>Why add the shift bit op? Just use:
>>>(mybyte & 128) != 0
>>
>>Just because to show what we are doing. When dealing with bits I find it more 'not hard coded' if I use bitpostion instead:)
>
>FWIW I did not find Michael's solution obscure or hard coded at all, given that one understands hexadecimal. Which one should if one is going to bit twiddle....

Hmm maybe I'm having an English problem here:) I can easily see it's 1 << 7 or 128 or 0x80 ...
However if someone needs something like this, then it's likely next step would be creating an indexer for it. For the indexer I think it would be much reasonable to index by bit positions rather than final bitshifted value.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform