Article View: es.comp.os.linux.programacion
Article #9510Re: Como acceder al bit x de un dato
From: Angel Luis JimĂ©nez MartĂnez
Date: Mon, 17 Jun 2002 16:53
Date: Mon, 17 Jun 2002 16:53
24 lines
1728 bytes
1728 bytes
Angel <a.lis@bussitel.es> wrote: > Suponiendo q tenemos un dato de n bytes, com podria acceder al bit x?? > en C o C++. > ej: > bool cual_es_el_valor_del_bit(n_bit); haciendo un and a nivel de bit (&) con una mascara que tenga el bit que queremos aislar con un valor de 1 y el resto de bits a 0. p.ej. queremos aislar el valor del 2ďż˝ bit de menor peso de un caracter. mascara= 0x02 = 00000010 binario resultado= caracter & mascara; > -- > Liso. -Eadem Mutata Resurgo- > Linux has you... --
Technical Details
Message-ID:
<ael471$2i7$1@marti.uji.es>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!mango.news.easynet.net!easynet-melon!easynet.net!news.rediris.es!news.uv.es!marti.uji.es!not-for-mailReferences:
<aekvlb$81hpu$1@ID-148170.news.dfncis.de>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,8245fc4b08721416
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-06-17 10:08:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!mango.news.easynet.net!easynet-melon!easynet.net!news.rediris.es!news.uv.es!marti.uji.es!not-for-mail
From: Angel Luis JimĂ©nez MartĂnez <al026635@alumail.uji.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Como acceder al bit x de un dato
Date: Mon, 17 Jun 2002 16:53:53 +0000 (UTC)
Organization: Universitat Jaume I
Lines: 24
Sender: Angel Luis JimĂ©nez MartĂnez <al026635@anubis.uji.es>
Message-ID: <ael471$2i7$1@marti.uji.es>
References: <aekvlb$81hpu$1@ID-148170.news.dfncis.de>
NNTP-Posting-Host: anubis.uji.es
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: 8bit
X-Trace: marti.uji.es 1024332833 2631 150.128.40.100 (17 Jun 2002 16:53:53 GMT)
X-Complaints-To: news@mati.uji.es
NNTP-Posting-Date: Mon, 17 Jun 2002 16:53:53 +0000 (UTC)
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (AIX/4-3)