private SeqAccessRank1 ( int curr_pos, int pos, int max, int &found_pos, natix.CompactDS.BitStreamCtxRL ctx ) : int | ||
curr_pos | int | |
pos | int | |
max | int | |
found_pos | int | |
ctx | natix.CompactDS.BitStreamCtxRL | |
return | int |
int SeqAccessRank1(int curr_pos, int pos, int max, out int found_pos, BitStreamCtxRL ctx)
{
int i = 0;
int u = -1;
while (i < max && curr_pos < pos) {
if (ctx.run_len > 0) {
u = ctx.run_len;
ctx.run_len = 0;
if (curr_pos + u > pos) {
u = pos - curr_pos;
}
curr_pos += u;
i += u;
} else {
u = this.ReadNext (ctx);
if (curr_pos + u > pos) {
break;
}
curr_pos += u;
i++;
}
}
found_pos = curr_pos;
return i;
}