Lines Matching refs:pos

82         private int pos;
95 state.pos=pos_;
111 pos_=state.pos;
181 int pos=pos_;
182 if(pos<0) {
186 return (remainingMatchLength_<0 && (node=bytes_[pos]&0xff)>=kMinValueLead) ?
213 int pos=pos_;
214 if(pos<0) {
223 if(inByte==(bytes_[pos++]&0xff)) {
225 pos_=pos;
227 return (length<0 && (node=bytes_[pos]&0xff)>=kMinValueLead) ?
234 return nextImpl(pos, inByte);
257 int pos=pos_;
258 if(pos<0) {
269 pos_=pos;
271 return (length<0 && (node=(bytes_[pos]&0xff))>=kMinValueLead) ?
279 if(inByte!=bytes_[pos]) {
283 ++pos;
287 int node=bytes_[pos++]&0xff;
289 Result result=branchNext(pos, node, inByte&0xff);
303 pos=pos_; // branchNext() advanced pos and wrote it to pos_ .
307 if(inByte!=bytes_[pos]) {
311 ++pos;
320 pos=skipValue(pos, node);
322 assert((bytes_[pos]&0xff)<kMinValueLead);
337 int pos=pos_;
338 int leadByte=bytes_[pos++]&0xff;
340 return readValue(bytes_, pos, leadByte>>1);
351 int pos=pos_;
352 if(pos<0) {
356 long uniqueValue=findUniqueValue(bytes_, pos+remainingMatchLength_+1, 0);
369 int pos=pos_;
370 if(pos<0) {
374 append(out, bytes_[pos]&0xff); // Next byte of a pending linear-match node.
377 int node=bytes_[pos++]&0xff;
382 pos=skipValue(pos, node);
383 node=bytes_[pos++]&0xff;
389 node=bytes_[pos++]&0xff;
391 getNextBranchBytes(bytes_, pos, ++node, out);
395 append(out, bytes_[pos]&0xff);
550 int pos=pos_;
551 if(pos<0) {
559 pos=(int)(top>>32);
563 pos=branchNext(pos, length);
564 if(pos<0) {
568 entry_.append(bytes_[pos++]);
577 int node=bytes_[pos++]&0xff;
581 entry_.value=readValue(bytes_, pos, node>>1);
585 pos_=skipValue(pos, node);
594 node=bytes_[pos++]&0xff;
596 pos=branchNext(pos, node+1);
597 if(pos<0) {
604 entry_.append(bytes_, pos, maxLength_-entry_.length);
607 entry_.append(bytes_, pos, length);
608 pos+=length;
628 private int branchNext(int pos, int length) {
630 ++pos; // ignore the comparison byte
632 stack_.add(((long)skipDelta(bytes_, pos)<<32)|((length-(length>>1))<<16)|entry_.length);
635 pos=jumpByDelta(bytes_, pos);
639 byte trieByte=bytes_[pos++];
640 int node=bytes_[pos++]&0xff;
642 int value=readValue(bytes_, pos, node>>1);
643 pos=skipValue(pos, node);
644 stack_.add(((long)pos<<32)|((length-1)<<16)|entry_.length);
651 return pos+value;
679 // pos is already after the leadByte, and the lead byte is already shifted right by 1.
680 private static int readValue(byte[] bytes, int pos, int leadByte) {
685 value=((leadByte-kMinTwoByteValueLead)<<8)|(bytes[pos]&0xff);
687 value=((leadByte-kMinThreeByteValueLead)<<16)|((bytes[pos]&0xff)<<8)|(bytes[pos+1]&0xff);
689 value=((bytes[pos]&0xff)<<16)|((bytes[pos+1]&0xff)<<8)|(bytes[pos+2]&0xff);
691 value=(bytes[pos]<<24)|((bytes[pos+1]&0xff)<<16)|((bytes[pos+2]&0xff)<<8)|(bytes[pos+3]&0xff);
695 private static int skipValue(int pos, int leadByte) {
699 ++pos;
701 pos+=2;
703 pos+=3+((leadByte>>1)&1);
706 return pos;
708 private static int skipValue(byte[] bytes, int pos) {
709 int leadByte=bytes[pos++]&0xff;
710 return skipValue(pos, leadByte);
714 private static int jumpByDelta(byte[] bytes, int pos) {
715 int delta=bytes[pos++]&0xff;
719 delta=((delta-kMinTwoByteDeltaLead)<<8)|(bytes[pos++]&0xff);
721 delta=((delta-kMinThreeByteDeltaLead)<<16)|((bytes[pos]&0xff)<<8)|(bytes[pos+1]&0xff);
722 pos+=2;
724 delta=((bytes[pos]&0xff)<<16)|((bytes[pos+1]&0xff)<<8)|(bytes[pos+2]&0xff);
725 pos+=3;
727 delta=(bytes[pos]<<24)|((bytes[pos+1]&0xff)<<16)|((bytes[pos+2]&0xff)<<8)|(bytes[pos+3]&0xff);
728 pos+=4;
730 return pos+delta;
733 private static int skipDelta(byte[] bytes, int pos) {
734 int delta=bytes[pos++]&0xff;
737 ++pos;
739 pos+=2;
741 pos+=3+(delta&1);
744 return pos;
750 private Result branchNext(int pos, int length, int inByte) {
753 length=bytes_[pos++]&0xff;
759 if(inByte<(bytes_[pos++]&0xff)) {
761 pos=jumpByDelta(bytes_, pos);
764 pos=skipDelta(bytes_, pos);
771 if(inByte==(bytes_[pos++]&0xff)) {
773 int node=bytes_[pos]&0xff;
780 ++pos;
781 // int delta=readValue(pos, node>>1);
787 delta=((node-kMinTwoByteValueLead)<<8)|(bytes_[pos++]&0xff);
789 delta=((node-kMinThreeByteValueLead)<<16)|((bytes_[pos]&0xff)<<8)|(bytes_[pos+1]&0xff);
790 pos+=2;
792 delta=((bytes_[pos]&0xff)<<16)|((bytes_[pos+1]&0xff)<<8)|(bytes_[pos+2]&0xff);
793 pos+=3;
795 delta=(bytes_[pos]<<24)|((bytes_[pos+1]&0xff)<<16)|((bytes_[pos+2]&0xff)<<8)|(bytes_[pos+3]&0xff);
796 pos+=4;
799 pos+=delta;
800 node=bytes_[pos]&0xff;
803 pos_=pos;
807 pos=skipValue(bytes_, pos);
809 if(inByte==(bytes_[pos++]&0xff)) {
810 pos_=pos;
811 int node=bytes_[pos]&0xff;
820 private Result nextImpl(int pos, int inByte) {
822 int node=bytes_[pos++]&0xff;
824 return branchNext(pos, node, inByte);
828 if(inByte==(bytes_[pos++]&0xff)) {
830 pos_=pos;
831 return (length<0 && (node=bytes_[pos]&0xff)>=kMinValueLead) ?
842 pos=skipValue(pos, node);
844 assert((bytes_[pos]&0xff)<kMinValueLead);
855 // On return, if not 0, then bits 63..33 contain the updated non-negative pos.
856 private static long findUniqueValueFromBranch(byte[] bytes, int pos, int length,
859 ++pos; // ignore the comparison byte
860 uniqueValue=findUniqueValueFromBranch(bytes, jumpByDelta(bytes, pos), length>>1, uniqueValue);
865 pos=skipDelta(bytes, pos);
868 ++pos; // ignore a comparison byte
870 int node=bytes[pos++]&0xff;
872 int value=readValue(bytes, pos, node>>1);
873 pos=skipValue(pos, node);
883 uniqueValue=findUniqueValue(bytes, pos+value, uniqueValue);
890 return ((long)(pos+1)<<33)|(uniqueValue&0x1ffffffffL);
896 private static long findUniqueValue(byte[] bytes, int pos, long uniqueValue) {
898 int node=bytes[pos++]&0xff;
901 node=bytes[pos++]&0xff;
903 uniqueValue=findUniqueValueFromBranch(bytes, pos, node+1, uniqueValue);
907 pos=(int)(uniqueValue>>>33);
910 pos+=node-kMinLinearMatch+1; // Ignore the match bytes.
913 int value=readValue(bytes, pos, node>>1);
924 pos=skipValue(pos, node);
930 // getNextBytes() when pos is on a branch node.
931 private static void getNextBranchBytes(byte[] bytes, int pos, int length, Appendable out) {
933 ++pos; // ignore the comparison byte
934 getNextBranchBytes(bytes, jumpByDelta(bytes, pos), length>>1, out);
936 pos=skipDelta(bytes, pos);
939 append(out, bytes[pos++]&0xff);
940 pos=skipValue(bytes, pos);
942 append(out, bytes[pos]&0xff);