Skip to content

Commit

Permalink
Fix rounding problem in parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasher committed Jan 22, 2015
1 parent 0c47867 commit 979aa93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
data
*.exe
*.exe
scm/Makefile
release.7z
*.diff
2 changes: 1 addition & 1 deletion parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewDataFromBytes(data []byte) (d Data) {

func NewDataFromBits(data string) (d Data) {
d.Bits = data
d.Bytes = make([]byte, len(data)>>3+1)
d.Bytes = make([]byte, (len(data)+7)>>3)
for idx := 0; idx < len(data); idx += 8 {
b, _ := strconv.ParseUint(d.Bits[idx:idx+8], 2, 8)
d.Bytes[idx>>3] = uint8(b)
Expand Down

0 comments on commit 979aa93

Please sign in to comment.