|
-
May 14th, 2011, 09:40 AM
#1
Need urgent help on my homework! Due day soon!
Hi all,
I'm programming an algorithm which needs to operate on bits. I know C/C++ has bitset class. But it is not enough for
me. Because I also need to do the operation with x(don't care) bit and we need to combine the bits together.
For example, let's use 3 to represent the don't-care bit. In case 1001 and 1000 are inputs which give same output,then
1001 and 1000 can be combined into 1003. And Similarly 1003 and 0003 can be combined into 3003.
But 1003 and 1101 can not be combined.
I also need bitwise operation such like the number of 1's.
How can I implement this class? Is there a fast way by just inheriting the behavior of <bitset> class?
Or do you suggest implementing the class from scratch?
Thanks!
Last edited by ertss; May 14th, 2011 at 09:42 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|