Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

Behind the connection: Original method to iterate the bits within an integer

$
0
0
Today, I would like to present you an original way of iterating thru all the bits in an integer. The usual way of iterating the bits is to build a moving bit mask in a loop and selecting each bit in turn with that mask. This works perfectly and it is fast. But today, I want to show you a better looking way of doing the same iteration. The final code is like this: var   OneBit : Boolean;begin

Viewing all articles
Browse latest Browse all 1725

Trending Articles