H
Hilton
Hi,
How about:
boolean abc [256];
protected void ShiftLeft ()
{
index++;
}
protected void ShiftRight ()
{
index--;
}
i.e. virtually move the data instead of physically moving it. Since I'm not
sure what your 'output' actually is, I cannot write that method for you. If
it's just bytes, then it's easy enough to run from index to the end of the
array and wrap around to construct the bytes. If your 'output' method gets
called very frequently, cache the result if "this.dirty" is true, and add
"this.dirty = true;" in each of the above methods. Obviously add a
"this.dirty = false" to your output method.
I'd traded off space vs. speed - this technique should be lightning quick,
but does use a little more memory - however if you have tons of these
objects...
So, does this work for you?
Hilton
How about:
boolean abc [256];
protected void ShiftLeft ()
{
index++;
}
protected void ShiftRight ()
{
index--;
}
i.e. virtually move the data instead of physically moving it. Since I'm not
sure what your 'output' actually is, I cannot write that method for you. If
it's just bytes, then it's easy enough to run from index to the end of the
array and wrap around to construct the bytes. If your 'output' method gets
called very frequently, cache the result if "this.dirty" is true, and add
"this.dirty = true;" in each of the above methods. Obviously add a
"this.dirty = false" to your output method.
I'd traded off space vs. speed - this technique should be lightning quick,
but does use a little more memory - however if you have tons of these
objects...
So, does this work for you?
Hilton