Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fixes CI complaints #4

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions parsing/padding.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

// Pad pads a general byte array in to Fr32 chunks of bytes where the topmost bits of the most significant byte are 0
func Pad(unpaddedData []byte) ([]fr32.Fr32, error) {
if unpaddedData == nil || len(unpaddedData) == 0 {
if len(unpaddedData) == 0 {
return nil, errors.New("empty input")
}
// Compute amount of Fr32 elements in the result
chunkCount := Ceil(len(unpaddedData)*8, fr32.BitsNeeded)
paddedData := make([]fr32.Fr32, chunkCount, chunkCount)
paddedData := make([]fr32.Fr32, chunkCount)
bitIdx := 0
for i := 0; i < chunkCount; i++ {
unpaddedChunk := getChunk(bitIdx, unpaddedData)
Expand Down Expand Up @@ -57,12 +57,12 @@ func shiftChunk(bitIdx int, unpaddedChunk []byte) [fr32.BytesNeeded]byte {

// Unpad a list of Fr32 padded elements into a contiguous byte array
func Unpad(paddedData []fr32.Fr32) ([]byte, error) {
if paddedData == nil || len(paddedData) == 0 {
if len(paddedData) == 0 {
return nil, errors.New("empty input")
}
// Compute amount of bytes in the result
bytes := Ceil(len(paddedData)*fr32.BitsNeeded, 8)
unpaddedData := make([]byte, bytes, bytes)
unpaddedData := make([]byte, bytes)
bitIdx := 0
for i := 0; i < len(paddedData); i++ {
chunk := paddedData[i].Data
Expand Down