|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
BackgroundA few days ago, I needed to keep track of operator state (on/off) for a large number of operators. For this, I intended to use a The CodeI used a Let's say that all I need to work with are 16 bits, the class creates a byte[] b = new byte[2]; //b[0] and b[1]
Now let's say that I want to set bit 10 to Using the CodeIn the attached project, I used the class to work out Prime Numbers using the Sieve of Eratosthenes method. Incidentally while creating this example, I also tried using When a instance of the //Calculation to Find Primes
for (Int32 i = 2; i < _topNumber; i++)
if (_numbers.GetValueAt(i))
for (Int32 j = i * 2; j < _topNumber; j += i)
_numbers.SetValueAt(j, false);
... where Points To NoteA bit of a disclaimer. The solution supplied to the problem described here works. It is not fast but I was not after speed and/or efficiency. History
|
|||||||||||||||||||||||||||||||||||