+ if !self.time_to_sample.is_empty() {
+ let mut remaining = exp_pts;
+ let mut abs_csamp = 0;
+ for &(count, scount) in self.time_to_sample.iter() {
+ let count = u64::from(count);
+ let scount = u64::from(scount);
+ let nblk = remaining / scount;
+ if nblk < count {
+ abs_csamp += nblk;
+ break;
+ }
+ remaining -= count * scount;
+ abs_csamp += count;
+ }
+ self.cur_sample = abs_csamp as usize;
+ } else {
+ self.cur_sample = exp_pts as usize;
+ }
+ let tgt_sample = self.cur_sample;