Thread View: be.comp.programming
5 messages
5 total messages
Started by Ivan Van den Bossche
Sat, 17 Jan 2004 15:28
Vraagje ivm C
Author: Ivan Van den Bossche
Date: Sat, 17 Jan 2004 15:28
Date: Sat, 17 Jan 2004 15:28
9 lines
1142 bytes
1142 bytes
Hi, Kan er mij iemand uitleggen wat ik met de volgende operators in C kan doen + eventueel een voorbeeldje: |= &= ~ Alvast bedankt Ivan
Re: Vraagje ivm C
Author: flippend rund
Date: Sat, 17 Jan 2004 15:40
Date: Sat, 17 Jan 2004 15:40
3 lines
1153 bytes
1153 bytes
Dat zijn bit-manipulaties die je kunt uitvoeren op integer data-types (char, short, int, long). Gelijk welk boek over C kan je dit in detail uitleggen.
Re: Vraagje ivm C
Author: Davy Loots
Date: Sat, 17 Jan 2004 20:32
Date: Sat, 17 Jan 2004 20:32
33 lines
1733 bytes
1733 bytes
Een klein voorbeeldje: |= bitwise OR vb. int a = 9; // == 00001001 binair a |= 12; // 12 == 00001100 binair resultaat : a == 13; // == 00001101 binair &= bitwise AND vb. int a = 9; a &= 12; resultaat : a == 8; // == 00001000 binair ~ bitwise NOT vb. int a = ~13; // == 00001101 binair resultaat a == 242; // == 11110010 binair Met vriendelijke groenten, Davy "flippend rund" <flippend@not.here.be> schreef in bericht news:aqli00tmc95v3dfhik1jntd0q2r8kur7ra@4ax.com... > Dat zijn bit-manipulaties die je kunt uitvoeren op integer data-types > (char, short, int, long). Gelijk welk boek over C kan je dit in detail > uitleggen. > >
Re: Vraagje ivm C
Author: Nicolas Barbier
Date: Sat, 17 Jan 2004 21:22
Date: Sat, 17 Jan 2004 21:22
14 lines
1540 bytes
1540 bytes
Davy Loots wrote: > ~ bitwise NOT > vb. > int a = ~13; // == 00001101 binair > resultaat > a == 242; // == 11110010 binair Dit hangt nogal af van hoe groot int's op de uitvoerende machine zijn. Een int-grootte van 8 bit ben ik nog niet tegengekomen ;-). -- Nicolas Barbier Protecting innovation against patent inflation <url:http://swpat.ffii.org/>
Re: Vraagje ivm C
Author: Davy Loots
Date: Sat, 17 Jan 2004 22:54
Date: Sat, 17 Jan 2004 22:54
19 lines
1721 bytes
1721 bytes
Ooops, foutje of hoe schrijf ik een bug op twee regels code... "Nicolas Barbier" <reply@in.group.invalid> schreef in bericht news:4009a849$0$1118$6c56d894@feed0.news.be.easynet.net... > Davy Loots wrote: > > > ~ bitwise NOT > > vb. > > int a = ~13; // == 00001101 binair > > resultaat > > a == 242; // == 11110010 binair > > Dit hangt nogal af van hoe groot int's op de uitvoerende machine zijn. Een > int-grootte van 8 bit ben ik nog niet tegengekomen ;-). > > -- > Nicolas Barbier > Protecting innovation against patent inflation <url:http://swpat.ffii.org/>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads