Skip to content

Commit

Permalink
Make polynomial a type
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-arista committed Oct 25, 2017
1 parent 0d4d83d commit 07a5840
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crc32_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
"hash/crc32"
)

type crcPolynomial int8

const (
crcIEEE = iota
crcIEEE crcPolynomial = iota
crcCastagnoli
)

Expand All @@ -16,7 +18,7 @@ var castagnoliTable = crc32.MakeTable(crc32.Castagnoli)
// crc32Field implements the pushEncoder and pushDecoder interfaces for calculating CRC32s.
type crc32Field struct {
startOffset int
polynomial int
polynomial crcPolynomial
}

func (c *crc32Field) saveOffset(in int) {
Expand All @@ -27,7 +29,7 @@ func (c *crc32Field) reserveLength() int {
return 4
}

func newCRC32Field(polynomial int) *crc32Field {
func newCRC32Field(polynomial crcPolynomial) *crc32Field {
return &crc32Field{polynomial: polynomial}
}

Expand Down

0 comments on commit 07a5840

Please sign in to comment.