🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #9591

Re: operacje na bitach

#9591
From: olek
Date: Tue, 25 Oct 2005 10:51
24 lines
1411 bytes
Karol napisał(a):
> Witam
> 
> I znowu ja. Mam jakąś liczbę typu int. Muszę zanegować jej bity i pobrać 
>     tylko jeden bajt z wyniku (najmniej znaczÄ…cy) jak to elegancko 
> zrobić w c#. Oczywiście .net 1.1 .
> 
> Dzięki za pomoc
> Pozdrawiam
> KArol

const int Maska = 0xFF;
int iWartosc;
byte byBit;

iWartosc = 10;

byBit = (byte)(iWartosc & Maska);

Czyli przez operacje logiczna AND. Maskujesz wzytskie bajty poza 
najmlodszym i sprawdzasz wynik .

Pozdrawiam Olek
----------------
Technical Details
Message-ID: <djl2uc$bp5$1@atlantis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <djkvmh$ugp$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: olek <olek@tkdami.net>
Newsgroups: alt.pl.comp.lang.csharp
Subject: Re: operacje na bitach
Date: Tue, 25 Oct 2005 12:51:33 +0200
Organization: tp.internet - http://www.tpi.pl/
Lines: 24
Message-ID: <djl2uc$bp5$1@atlantis.news.tpi.pl>
References: <djkvmh$ugp$1@news.onet.pl>
NNTP-Posting-Host: nat.udn.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1130237708 12069 82.139.8.9 (25 Oct 2005 10:55:08 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Tue, 25 Oct 2005 10:55:08 +0000 (UTC)
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: pl, en-us, en
In-Reply-To: <djkvmh$ugp$1@news.onet.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit