Lines Matching refs:buffer

781  * Counts the number of contiguous varints in a buffer.
782 * @param {!Uint8Array} buffer The buffer to scan.
783 * @param {number} start The starting point in the buffer to scan.
784 * @param {number} end The end point in the buffer to scan.
785 * @return {number} The number of varints in the buffer.
787 jspb.utils.countVarints = function(buffer, start, end) {
788 // Count how many high bits of each byte were set in the buffer.
791 count += buffer[i] >> 7;
794 // The number of varints in the buffer equals the size of the buffer minus
795 // the number of non-terminal bytes in the buffer (those with the high bit
803 * the buffer.
804 * @param {!Uint8Array} buffer The buffer to scan.
805 * @param {number} start The starting point in the buffer to scan.
806 * @param {number} end The end point in the buffer to scan.
808 * @return {number} The number of matching fields in the buffer.
810 jspb.utils.countVarintFields = function(buffer, start, end, field) {
819 if (buffer[cursor++] != tag) return count;
826 var x = buffer[cursor++];
835 if (buffer[cursor] != ((temp & 0x7F) | 0x80)) return count;
839 if (buffer[cursor++] != temp) return count;
846 var x = buffer[cursor++];
857 * buffer.
858 * @param {!Uint8Array} buffer The buffer to scan.
859 * @param {number} start The starting point in the buffer to scan.
860 * @param {number} end The end point in the buffer to scan.
863 * @return {number} The number of fields with a matching tag in the buffer.
867 function(buffer, start, end, tag, stride) {
875 if (buffer[cursor++] != tag) return count;
888 if (buffer[cursor++] != ((temp & 0x7F) | 0x80)) return count;
891 if (buffer[cursor++] != temp) return count;
906 * in the buffer.
907 * @param {!Uint8Array} buffer The buffer to scan.
908 * @param {number} start The starting point in the buffer to scan.
909 * @param {number} end The end point in the buffer to scan.
911 * @return {number} The number of matching fields in the buffer.
913 jspb.utils.countFixed32Fields = function(buffer, start, end, field) {
915 return jspb.utils.countFixedFields_(buffer, start, end, tag, 4);
921 * in the buffer.
922 * @param {!Uint8Array} buffer The buffer to scan.
923 * @param {number} start The starting point in the buffer to scan.
924 * @param {number} end The end point in the buffer to scan.
926 * @return {number} The number of matching fields in the buffer.
928 jspb.utils.countFixed64Fields = function(buffer, start, end, field) {
930 return jspb.utils.countFixedFields_(buffer, start, end, tag, 8);
936 * in the buffer.
937 * @param {!Uint8Array} buffer The buffer to scan.
938 * @param {number} start The starting point in the buffer to scan.
939 * @param {number} end The end point in the buffer to scan.
941 * @return {number} The number of matching fields in the buffer.
943 jspb.utils.countDelimitedFields = function(buffer, start, end, field) {
952 if (buffer[cursor++] != ((temp & 0x7F) | 0x80)) return count;
955 if (buffer[cursor++] != temp) return count;
964 temp = buffer[cursor++];