Skip to content

Commit

Permalink
rename power of two util
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Aug 23, 2022
1 parent 24ff776 commit 721e31e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/shares/share_splitting.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
)

func Split(data coretypes.Data) ([][]byte, error) {
if data.OriginalSquareSize == 0 || !powerOf2(data.OriginalSquareSize) {
if data.OriginalSquareSize == 0 || !isPowerOf2(data.OriginalSquareSize) {
return nil, fmt.Errorf("square size is not a power of two: %d", data.OriginalSquareSize)
}
wantShareCount := int(data.OriginalSquareSize * data.OriginalSquareSize)
Expand Down
7 changes: 2 additions & 5 deletions pkg/shares/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ func MessageShareCountsFromMessages(msgs []*core.Message) []int {
return e
}

func powerOf2(v uint64) bool {
if v&(v-1) == 0 && v != 0 {
return true
}
return false
func isPowerOf2(v uint64) bool {
return v&(v-1) == 0 && v != 0
}

func MessagesToProto(msgs []coretypes.Message) []*core.Message {
Expand Down

0 comments on commit 721e31e

Please sign in to comment.