Skip to content

Commit

Permalink
Fixup addition with a BitIndex (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben J. Ward authored Jun 5, 2020
1 parent f8274b0 commit fb8b3a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bit-manipulation/bitindex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ offset_mask(i::BitIndex{N, W}) where {N, W} = UInt8(8 * sizeof(W)) - 0x01
index(i::BitIndex) = (i.val >> index_shift(i)) + 1
offset(i::BitIndex) = i.val & offset_mask(i)

Base.:+(i::BitIndex{N,W}, n::Int) where {N,W} = BitIndex{N,W}(i.val + n)
Base.:-(i::BitIndex{N,W}, n::Int) where {N,W} = BitIndex{N,W}(i.val - n)
Base.:+(i::BitIndex{N,W}, n::Integer) where {N,W} = BitIndex{N,W}(i.val + n)
Base.:-(i::BitIndex{N,W}, n::Integer) where {N,W} = BitIndex{N,W}(i.val - n)
Base.:-(i1::BitIndex, i2::BitIndex) = i1.val - i2.val
Base.:(==)(i1::BitIndex, i2::BitIndex) = i1.val == i2.val
Base.isless(i1::BitIndex, i2::BitIndex) = isless(i1.val, i2.val)
Expand Down

0 comments on commit fb8b3a7

Please sign in to comment.