right shift a packBCD string

Hi,

I have this BCD string: 890123...78FFF and need to right shift by say 3 nibbles, resulting in: FFF890123...78
length is fixed, number of 'f' nibbles are varying.

appreciate any algorithm/tips on this. thanks.
See:

http://www.cplusplus.com/reference/string/string/?kw=string

1
2
3
4
5
6
for(int i = 0; i < f; ++i)
{
  char ch = bcd_str.back();
  bcd_str.pop_back();
  bcd_str.insert(0, ch);
}
we're nibble shifting, so I wonder if above the code will work, which is char shifting (i.e a byte). thanks for response anyways.
Topic archived. No new replies allowed.