Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(435)

Delta Between Two Patch Sets: src/pkg/compress/bzip2/bit_reader.go

Issue 9915043: code review 9915043: compress/bzip2: faster decoding. (Closed)
Left Patch Set: Created 10 years, 10 months ago
Right Patch Set: diff -r 4e0de2c84cc1 https://go.googlecode.com/hg/ Created 10 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/compress/bzip2/bzip2_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package bzip2 5 package bzip2
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "io" 9 "io"
10 ) 10 )
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 func (br *bitReader) ReadBits(bits uint) (n int) { 70 func (br *bitReader) ReadBits(bits uint) (n int) {
71 n64 := br.ReadBits64(bits) 71 n64 := br.ReadBits64(bits)
72 return int(n64) 72 return int(n64)
73 } 73 }
74 74
75 func (br *bitReader) ReadBit() bool { 75 func (br *bitReader) ReadBit() bool {
76 n := br.ReadBits(1) 76 n := br.ReadBits(1)
77 return n != 0 77 return n != 0
78 } 78 }
79 79
80 func (br *bitReader) TryReadBit() (bit byte, ok bool) {
81 if br.bits > 0 {
82 br.bits--
83 return byte(br.n>>br.bits) & 1, true
84 }
85 return 0, false
86 }
87
80 func (br *bitReader) Err() error { 88 func (br *bitReader) Err() error {
81 return br.err 89 return br.err
82 } 90 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b