From 07a5840e2e478061894dcd28bd996a472d611bfc Mon Sep 17 00:00:00 2001 From: Vlad Hanciuta Date: Wed, 25 Oct 2017 15:45:01 +0100 Subject: [PATCH] Make polynomial a type --- crc32_field.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crc32_field.go b/crc32_field.go index b8a6d5e28..1f144431a 100644 --- a/crc32_field.go +++ b/crc32_field.go @@ -6,8 +6,10 @@ import ( "hash/crc32" ) +type crcPolynomial int8 + const ( - crcIEEE = iota + crcIEEE crcPolynomial = iota crcCastagnoli ) @@ -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) { @@ -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} }