is there a way to set up an array of bits of generic size, cycle
through all the possible bit patterns, and detect a sub-pattern within
the bit pattern?
for cycling through possible patterns: i was thinking of just using an
unsigned int that increments for the cycling of bit patterns, but those
only come in prescribed sizes. i was hoping for something more generic,
that would allow for a 10bit pattern, for example.
for the sub-pattern analysis: i was hoping to analyze each bit pattern,
and be able to answer questions like "how many bits are 1 in this
pattern?" and "are there three bits in a row that are 1 in this
pattern?"
i can cludge something together using string manipulation, but that
will be much larger, and i'm guessing much slower, than bit pattern
manipulation. any ideas of what i could use for a bit pattern solution?
thanks,
jason 3 2107
for the cycling: actually, now that i think about it, i guess i could
just use the largest non-floating numeric type, and control how large
the value could get with the loop constraints. that would, in effect,
give me a bit pattern of arbitrary size, up to the maximum size of the
datatype. that would work. so i guess my only question now is about the
sub-pattern analysis.
thanks,
jason
Perhaps you should investigate around the BitArray class...
"jason" <ia****@yahoo.com> a écrit dans le message de news: 11**********************@f14g2000cwb.googlegroups. com... is there a way to set up an array of bits of generic size, cycle through all the possible bit patterns, and detect a sub-pattern within the bit pattern?
for cycling through possible patterns: i was thinking of just using an unsigned int that increments for the cycling of bit patterns, but those only come in prescribed sizes. i was hoping for something more generic, that would allow for a 10bit pattern, for example.
for the sub-pattern analysis: i was hoping to analyze each bit pattern, and be able to answer questions like "how many bits are 1 in this pattern?" and "are there three bits in a row that are 1 in this pattern?"
i can cludge something together using string manipulation, but that will be much larger, and i'm guessing much slower, than bit pattern manipulation. any ideas of what i could use for a bit pattern solution?
thanks,
jason
thanks! this loooks good. quick question though. is there a way to
increment the binary pattern that the bit array makes? i didn't notice
anything built into the class that would do it.
i suppose could still use an integer to increment, and then pass that
integer value into the constructor of a BitArray for pattern analysis.
but i wasn't sure if there was a BitArray incrementer hidden somewhere,
since that seems like it would be useful!
thanks again,
jason This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Medi Montaseri |
last post by:
Hi,
Given a collection of similar but not exact entities (or products)
Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern
to provide a common interface to these products....
|
by: cantabile |
last post by:
Hi,
I'm trying to write a small installer for a server. But this program
should be able to run in the future under heterogenous environments and
os (at least linux/windows). I mean, the install...
|
by: Tom Dacon |
last post by:
I'm curious to see if anyone has an opinion on this little design question -
I'm doing a computational astronomy library in C#, purely for my own use,
and one of the things that happens regularly...
|
by: Peter Rilling |
last post by:
A design pattern question.
As you know, an enumerator in .NET is broken into two interface (IEnumerable
and IEnumerator). Is there a benefit in having two interfaces? Why not
just have the...
|
by: Joe Van Dyk |
last post by:
I'm certain that there's some type of a design pattern that neatly
solves my problem, but I dunno what it is.
I need to create Message objects based on on the contents of a string
(that's...
|
by: Bill44077 |
last post by:
Hi,
I am new to the MVP pattern and one of the main reasons that we are going
this route is because we are doing Scrum with 30 day sprints - so we have a
continually morphing design. We are...
|
by: Alan Isaac |
last post by:
I have two questions about the "observer pattern" in Python.
This is question #1. (I'll put the other is a separate post.)
Here is a standard example of the observer pattern in Python:
|
by: Alan Isaac |
last post by:
I have two questions about the "observer pattern" in Python.
This is question #2. (I'll put the other is a separate post.)
Consider this standard example of the observer pattern in Python:
|
by: CSharper |
last post by:
I have created a Factory pattern code. One thing I noticed after
coding, each factory has some methods they are exactly same and doing
the same code using the values specific to each factory, if I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |