+ 2
What is the best way to realize a shift register in c#?
I was wondering if there is a small and easy way to implement a shift register like you maybe know from labview. Shifting to the left/right should be choosable and range should possibly change dynamically. Sry for bad english. Upvotes are appreciated. Cheers, KK.
1 Antwort
+ 1
where
Contents is the current contents of the register
tapSequence is the XOR tap sequence, where a 1 represents a tapped bit and a 0 represents an untapped bit.
length is the number of bits the register has.
However, having run a CPU usage test, this function takes up as much as 60% of my runtime (for what I thought would've been a fairly lightweight method). Is there a more efficient way to write this? Is there a way to XOR the contents of an int with its own bits (so as to do away with the for loop)?