From a81b748b6f51f3f256fca8e4388520fb32dc2a7b Mon Sep 17 00:00:00 2001 From: sweexordious Date: Mon, 3 Jun 2024 02:10:58 +0400 Subject: [PATCH] chore: remove unnecessary core --- nmt.go | 5 ----- nmt_test.go | 27 --------------------------- 2 files changed, 32 deletions(-) diff --git a/nmt.go b/nmt.go index 84bc817..76591c5 100644 --- a/nmt.go +++ b/nmt.go @@ -669,11 +669,6 @@ func (n *NamespacedMerkleTree) ComputeSubtreeRoot(start, end int) ([]byte, error return n.computeRoot(start, end) } -// isPowerOfTwo checks if a number is a power of two -func isPowerOfTwo(n int) bool { - return n > 0 && (n&(n-1)) == 0 -} - type LeafRange struct { // Start and End denote the indices of a leaf in the tree. // Start ranges from 0 up to the total number of leaves minus 1. diff --git a/nmt_test.go b/nmt_test.go index b10e0e4..10d3d2b 100644 --- a/nmt_test.go +++ b/nmt_test.go @@ -1190,33 +1190,6 @@ func TestForcedOutOfOrderNamespacedMerkleTree(t *testing.T) { } } -func TestIsPowerOfTwo(t *testing.T) { - tests := []struct { - input int - expected bool - }{ - {input: 0, expected: false}, - {input: 1, expected: true}, - {input: 2, expected: true}, - {input: 3, expected: false}, - {input: 4, expected: true}, - {input: 5, expected: false}, - {input: 8, expected: true}, - {input: 16, expected: true}, - {input: -1, expected: false}, - {input: -2, expected: false}, - } - - for _, tt := range tests { - t.Run(fmt.Sprintf("input=%d", tt.input), func(t *testing.T) { - result := isPowerOfTwo(tt.input) - if result != tt.expected { - t.Errorf("expected %v, got %v", tt.expected, result) - } - }) - } -} - func TestComputeSubtreeRoot(t *testing.T) { n := exampleNMT2(1, true, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) tests := []struct {