Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/snksoft/crc
Browse files Browse the repository at this point in the history
  • Loading branch information
snksoft committed Jun 4, 2018
2 parents ee26f30 + b1d83c9 commit c29f141
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src [![GoDoc](https://godoc.org/github.com/snksoft/src?status.png)](https://godoc.org/github.com/snksoft/crc)
crc [![GoDoc](https://godoc.org/github.com/snksoft/src?status.png)](https://godoc.org/github.com/snksoft/crc)
========
This package implements generic CRC calculations up to 64 bits wide.
It aims to be fairly fast and fairly complete, allowing users to match pretty much
Expand All @@ -17,7 +17,7 @@ go get github.com/snksoft/crc

## Usage

Using src is easy. Here is an example of calculating CCITT crc.
Using `crc` is easy. Here is an example of calculating a CCITT crc.
```go
package main

Expand All @@ -33,7 +33,8 @@ func main() {
}
```

For larger data, table driven implementation is faster. Here is how to use it. Note that crc.Hash impements hash.Hash interface, so you can use it instead if you want.
For larger data, table driven implementation is faster. Note that `crc.Hash` implements `hash.Hash` interface, so you can use it instead if you want.
Here is how to use it:
```go
package main

Expand All @@ -58,13 +59,13 @@ func main() {
}
```
## Notes
Beware that Hash instance is not thread safe. If you want to do parallel CRC calculations, then either use NewHash() to create multiple Hash instances or simply make a copy of Hash whehever you need it. Latter option avoids recalculating CRC table, but keep in mind that NewHash() returns a pointer, so simple assignement will point to the same instance.
Use either
Beware that Hash instance is not thread safe. If you want to do parallel CRC calculations, then either use `NewHash()` to create multiple Hash instances or simply make a copy of Hash whehever you need it. Latter option avoids recalculating CRC table, but keep in mind that `NewHash()` returns a pointer, so simple assignement will point to the same instance.
Use either
```go
hash2 := &crc.Hash{}
*hash2 = *hash
hash2 := &crc.Hash{}
*hash2 = *hash
```
or simply
or simply
```go
var hash2 = *hash
var hash2 = *hash
```

0 comments on commit c29f141

Please sign in to comment.