Article View: be.comp.programming
Article #5205Re: VRAAGJE C/C++
From: Stefan Arentz
Date: Mon, 19 May 2003 09:31
Date: Mon, 19 May 2003 09:31
26 lines
2022 bytes
2022 bytes
"Marcus" <doei@bannerswapnl.com> writes:
> Dr.Ruud wrote:
> > Ivan Van den Bossche skribis:
> >
> >> Zou er iemand mij kunnen uitleggen wat de volgende functie doet?
> >>
> >> int TestBit(BYTE val, int intIndex)
> >> {
> >> return ((val & (1 << intIndex)) > index) ? 1 : 0;
> >> }
> >
> > Zou misschien dit worden bedoeld?
> > return ((val & (1 << intIndex)) >> intIndex) ? 1 : 0;
> >
> > Niet dat die '>> intIndex' dan nodig is overigens.
>
> Of de ?1:0 is juist niet nodig (en eigenlijk allebei niet, maar t _kan_
> natuurlijk dat de procedure die dit terugkrijgt expliciet op 0 of 1
> checkt)
C 101:
return ((val >> index) & 1);
S.
Technical Details
Message-ID:
<87k7cn9tae.fsf@keyser.soze.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newsswitch.lcs.mit.edu!news-FFM2.ecrc.net!news.hamburg.cityline.net!newsfeed.hamburg.cityline.net!kleenex.wirehub.nl!news.wirehub.nl!not-for-mailReferences:
<CVJxa.7359$1u5.531@afrodite.telenet-ops.be> <ba9frt.1ms.1@news.isolution.nl> <3ec88325$0$118$e4fe514c@dreader4.news.xs4all.nl>Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit X-Google-Thread: 107324,2cd6db1915f275ab X-Google-Attributes: gid107324,public X-Google-Thread: fcea4,2cd6db1915f275ab X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2003-05-19 02:34:08 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newsswitch.lcs.mit.edu!news-FFM2.ecrc.net!news.hamburg.cityline.net!newsfeed.hamburg.cityline.net!kleenex.wirehub.nl!news.wirehub.nl!not-for-mail From: Stefan Arentz <stefan.arentz@soze.com> Newsgroups: be.comp.programming,nl.comp.programmeren Subject: Re: VRAAGJE C/C++ Date: 19 May 2003 11:31:37 +0200 Organization: Wirehub! Internet, The Netherlands Lines: 26 Message-ID: <87k7cn9tae.fsf@keyser.soze.com> References: <CVJxa.7359$1u5.531@afrodite.telenet-ops.be> <ba9frt.1ms.1@news.isolution.nl> <3ec88325$0$118$e4fe514c@dreader4.news.xs4all.nl> NNTP-Posting-Host: newsreader2.wirehub.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: thor.wirehub.nl 1053336818 82776 195.86.128.19 (19 May 2003 09:33:38 GMT) X-Complaints-To: abuse@wirehub.net NNTP-Posting-Date: 19 May 2003 09:33:38 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Cache-Post-Path: newsreader2.wirehub.nl!unknown@keyser.soze.com X-Cache: nntpcache 2.4.0b2 (see http://www.nntpcache.org/)