Lines Matching refs:pos

84         private int pos;
98 state.pos=pos_;
115 pos_=state.pos;
194 int pos=pos_;
195 if(pos<0) {
199 return (remainingMatchLength_<0 && (node=bytes_[pos]&0xff)>=kMinValueLead) ?
228 int pos=pos_;
229 if(pos<0) {
238 if(inByte==(bytes_[pos++]&0xff)) {
240 pos_=pos;
242 return (length<0 && (node=bytes_[pos]&0xff)>=kMinValueLead) ?
249 return nextImpl(pos, inByte);
273 int pos=pos_;
274 if(pos<0) {
285 pos_=pos;
287 return (length<0 && (node=(bytes_[pos]&0xff))>=kMinValueLead) ?
295 if(inByte!=bytes_[pos]) {
299 ++pos;
303 int node=bytes_[pos++]&0xff;
305 Result result=branchNext(pos, node, inByte&0xff);
319 pos=pos_; // branchNext() advanced pos and wrote it to pos_ .
323 if(inByte!=bytes_[pos]) {
327 ++pos;
336 pos=skipValue(pos, node);
338 assert((bytes_[pos]&0xff)<kMinValueLead);
354 int pos=pos_;
355 int leadByte=bytes_[pos++]&0xff;
357 return readValue(bytes_, pos, leadByte>>1);
369 int pos=pos_;
370 if(pos<0) {
374 long uniqueValue=findUniqueValue(bytes_, pos+remainingMatchLength_+1, 0);
388 int pos=pos_;
389 if(pos<0) {
393 append(out, bytes_[pos]&0xff); // Next byte of a pending linear-match node.
396 int node=bytes_[pos++]&0xff;
401 pos=skipValue(pos, node);
402 node=bytes_[pos++]&0xff;
408 node=bytes_[pos++]&0xff;
410 getNextBranchBytes(bytes_, pos, ++node, out);
414 append(out, bytes_[pos]&0xff);
579 int pos=pos_;
580 if(pos<0) {
588 pos=(int)(top>>32);
592 pos=branchNext(pos, length);
593 if(pos<0) {
597 entry_.append(bytes_[pos++]);
606 int node=bytes_[pos++]&0xff;
610 entry_.value=readValue(bytes_, pos, node>>1);
614 pos_=skipValue(pos, node);
623 node=bytes_[pos++]&0xff;
625 pos=branchNext(pos, node+1);
626 if(pos<0) {
633 entry_.append(bytes_, pos, maxLength_-entry_.length);
636 entry_.append(bytes_, pos, length);
637 pos+=length;
657 private int branchNext(int pos, int length) {
659 ++pos; // ignore the comparison byte
661 stack_.add(((long)skipDelta(bytes_, pos)<<32)|((length-(length>>1))<<16)|entry_.length);
664 pos=jumpByDelta(bytes_, pos);
668 byte trieByte=bytes_[pos++];
669 int node=bytes_[pos++]&0xff;
671 int value=readValue(bytes_, pos, node>>1);
672 pos=skipValue(pos, node);
673 stack_.add(((long)pos<<32)|((length-1)<<16)|entry_.length);
680 return pos+value;
708 // pos is already after the leadByte, and the lead byte is already shifted right by 1.
709 private static int readValue(byte[] bytes, int pos, int leadByte) {
714 value=((leadByte-kMinTwoByteValueLead)<<8)|(bytes[pos]&0xff);
716 value=((leadByte-kMinThreeByteValueLead)<<16)|((bytes[pos]&0xff)<<8)|(bytes[pos+1]&0xff);
718 value=((bytes[pos]&0xff)<<16)|((bytes[pos+1]&0xff)<<8)|(bytes[pos+2]&0xff);
720 value=(bytes[pos]<<24)|((bytes[pos+1]&0xff)<<16)|((bytes[pos+2]&0xff)<<8)|(bytes[pos+3]&0xff);
724 private static int skipValue(int pos, int leadByte) {
728 ++pos;
730 pos+=2;
732 pos+=3+((leadByte>>1)&1);
735 return pos;
737 private static int skipValue(byte[] bytes, int pos) {
738 int leadByte=bytes[pos++]&0xff;
739 return skipValue(pos, leadByte);
743 private static int jumpByDelta(byte[] bytes, int pos) {
744 int delta=bytes[pos++]&0xff;
748 delta=((delta-kMinTwoByteDeltaLead)<<8)|(bytes[pos++]&0xff);
750 delta=((delta-kMinThreeByteDeltaLead)<<16)|((bytes[pos]&0xff)<<8)|(bytes[pos+1]&0xff);
751 pos+=2;
753 delta=((bytes[pos]&0xff)<<16)|((bytes[pos+1]&0xff)<<8)|(bytes[pos+2]&0xff);
754 pos+=3;
756 delta=(bytes[pos]<<24)|((bytes[pos+1]&0xff)<<16)|((bytes[pos+2]&0xff)<<8)|(bytes[pos+3]&0xff);
757 pos+=4;
759 return pos+delta;
762 private static int skipDelta(byte[] bytes, int pos) {
763 int delta=bytes[pos++]&0xff;
766 ++pos;
768 pos+=2;
770 pos+=3+(delta&1);
773 return pos;
779 private Result branchNext(int pos, int length, int inByte) {
782 length=bytes_[pos++]&0xff;
788 if(inByte<(bytes_[pos++]&0xff)) {
790 pos=jumpByDelta(bytes_, pos);
793 pos=skipDelta(bytes_, pos);
800 if(inByte==(bytes_[pos++]&0xff)) {
802 int node=bytes_[pos]&0xff;
809 ++pos;
810 // int delta=readValue(pos, node>>1);
816 delta=((node-kMinTwoByteValueLead)<<8)|(bytes_[pos++]&0xff);
818 delta=((node-kMinThreeByteValueLead)<<16)|((bytes_[pos]&0xff)<<8)|(bytes_[pos+1]&0xff);
819 pos+=2;
821 delta=((bytes_[pos]&0xff)<<16)|((bytes_[pos+1]&0xff)<<8)|(bytes_[pos+2]&0xff);
822 pos+=3;
824 delta=(bytes_[pos]<<24)|((bytes_[pos+1]&0xff)<<16)|((bytes_[pos+2]&0xff)<<8)|(bytes_[pos+3]&0xff);
825 pos+=4;
828 pos+=delta;
829 node=bytes_[pos]&0xff;
832 pos_=pos;
836 pos=skipValue(bytes_, pos);
838 if(inByte==(bytes_[pos++]&0xff)) {
839 pos_=pos;
840 int node=bytes_[pos]&0xff;
849 private Result nextImpl(int pos, int inByte) {
851 int node=bytes_[pos++]&0xff;
853 return branchNext(pos, node, inByte);
857 if(inByte==(bytes_[pos++]&0xff)) {
859 pos_=pos;
860 return (length<0 && (node=bytes_[pos]&0xff)>=kMinValueLead) ?
871 pos=skipValue(pos, node);
873 assert((bytes_[pos]&0xff)<kMinValueLead);
884 // On return, if not 0, then bits 63..33 contain the updated non-negative pos.
885 private static long findUniqueValueFromBranch(byte[] bytes, int pos, int length,
888 ++pos; // ignore the comparison byte
889 uniqueValue=findUniqueValueFromBranch(bytes, jumpByDelta(bytes, pos), length>>1, uniqueValue);
894 pos=skipDelta(bytes, pos);
897 ++pos; // ignore a comparison byte
899 int node=bytes[pos++]&0xff;
901 int value=readValue(bytes, pos, node>>1);
902 pos=skipValue(pos, node);
912 uniqueValue=findUniqueValue(bytes, pos+value, uniqueValue);
919 return ((long)(pos+1)<<33)|(uniqueValue&0x1ffffffffL);
925 private static long findUniqueValue(byte[] bytes, int pos, long uniqueValue) {
927 int node=bytes[pos++]&0xff;
930 node=bytes[pos++]&0xff;
932 uniqueValue=findUniqueValueFromBranch(bytes, pos, node+1, uniqueValue);
936 pos=(int)(uniqueValue>>>33);
939 pos+=node-kMinLinearMatch+1; // Ignore the match bytes.
942 int value=readValue(bytes, pos, node>>1);
953 pos=skipValue(pos, node);
959 // getNextBytes() when pos is on a branch node.
960 private static void getNextBranchBytes(byte[] bytes, int pos, int length, Appendable out) {
962 ++pos; // ignore the comparison byte
963 getNextBranchBytes(bytes, jumpByDelta(bytes, pos), length>>1, out);
965 pos=skipDelta(bytes, pos);
968 append(out, bytes[pos++]&0xff);
969 pos=skipValue(bytes, pos);
971 append(out, bytes[pos]&0xff);