Ads by Google

Donate

If you like articles and you want an increase of them, please make a little donation. If you make a donation you can submit us by mail an argument for next articles!

Importo: 

add RSS

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati

Subscribe to Blog

Follow us on Twitter

follow us

Manfriday blog gadget

C++


Count bits with value 1
Venerdì 10 Aprile 2009 13:33

The ANSI C++ bitset function allows to transform an Integer in a bit arrat

bitset<32> bitarray( myInt32 );

Now that you have an array you can use methods :

 bitarray.count() that allows to  count bits with value 1

bitarray.flip() that allows to invert bit order

and many other... a very useful utility 

 

 


Ricerca personalizzata