-static int VECTOR_INDEX_PART_INC(vector_index *index,int part) {
- if ( part & 1 ) {
- return VECTOR_PART_BYTE(index,part).lsb--;
+/**
+ * Decrement the index part at the indicated level, cyclic but not
+ * carrying over to the upper level. Returns the prior level index.
+ */
+static unsigned long VECTOR_INDEX_PART_DEC(
+ vector *pv,vector_index *index, int level)
+{
+ unsigned char *px = (unsigned char *) index;
+ switch ( pv->variant ) {
+ case byte_index_levels: {
+ byte *pp = (byte*)( px + level );
+ return (pp->a)--;
+ }
+ case nibble_index_levels: {
+ nibble *pp = (nibble*)( px + ( level / 2 ) );
+ switch ( level & 1 ) {
+ case 0: return (pp->a)--;
+ case 1: return (pp->b)--;
+ }
+ break;
+ }
+ case bitpair_index_levels: {
+ bitpair *pp = (bitpair*)( px + level / 4 );
+ switch ( level & 0xf ) {
+ case 0: return (pp->a)--;
+ case 1: return (pp->b)--;
+ case 2: return (pp->c)--;
+ case 3: return (pp->d)--;
+ }
+ break;