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
"Be Learning" <co*****@hotpop.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I need your help!
I want to declare and shift left a buffer that bigger then any basic data
type that C/C++ supports
And I'm doing so:
--------------------------------------------------------------------------
-
unsigned char arr[32];
for (int i=0; i<31; i++)
{
code = arr[i+1] & 0x80;
arr[i] <<= 1;
arr[i] |= code;
}
arr[i] <<= 1;
--------------------------------------------------------------------------
- Any one can suggest me other way?