search algorithm

F

fenwayfool

Anyone ever do something similar to the following in C++?

I need to create a database that has a fairly long key. Consider the
key a bitstring. My problem is that this key also has an associated
mask. All bits that we "care" about in the key have a mask value of
'1' while the don't care bits are marked with a zero.

Basically I want to simulate the operation of a ternary CAM in
software in a semi efficient manner. I have a few other databases I
use a hash_map<> for which works just fine... but the introduction of
a "don't care" mask eliminates this as a possibility.

For example let's assume the key/mask is 32 bits. If I have the
following in my database:

key: 0xA0A000001
mask: 0xFFFF000F

Should match a key such as 0xA0A00007 (the lookup does not specify a
key).

A search solution that returns more than 1 match is possible....
similar to a partial match for a string.

Anyway... anyone ever do anthing similar and if so what was your
solution?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top