Skip to content

Commit

Permalink
Removed extra code
Browse files Browse the repository at this point in the history
  • Loading branch information
jainbhavya53 committed Sep 25, 2024
1 parent 0d57ef5 commit 742731e
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions internal/eval/bitpos.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,29 +136,11 @@ func adjustBitPosSearchRange(start, end, byteLen int) (newStart, newEnd int) {
end += byteLen
}
start = max(0, start)
// TODO[Bhavya]:
// Fix scenario:For scenario where end = -200 and byteLen = 100, then end = -100
end = min(byteLen-1, end)

return start, end
}

func getBitPosWithByteRange(byteSlice []byte, bitToFind byte, start, end int) int {
for i := start; i <= end; i++ {
for j := 0; j < 8; j++ {
// Check each bit in the byte from left to right
// We use 7-j because bit 7 is the leftmost (most significant) bit
if ((byteSlice[i] >> (7 - j)) & 1) == bitToFind {
// Return the bit position (i*8 gives us the byte offset in bits)
return i*8 + j
}
}
}

// Bit not found in the range
return -1
}

func getBitPosWithBitRange(byteSlice []byte, bitToFind byte, start, end int) int {
for i := start; i <= end; i++ {
// Calculate which byte and bit we're looking at
Expand Down

0 comments on commit 742731e

Please sign in to comment.