Skip to content

Commit

Permalink
^^^ is deprecated use bitwise instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Argonus committed Oct 7, 2023
1 parent 4ca6c43 commit bffd468
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/kafka_ex/utils/murmur.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule KafkaEx.Utils.Murmur do
def murmur2(key) do
<<seed::signed-size(32)>> = <<@seed::size(32)>>
len = byte_size(key)
_murmur2(key, seed ^^^ len)
_murmur2(key, bxor(seed, len))
end

@doc """
Expand Down Expand Up @@ -54,27 +54,27 @@ defmodule KafkaEx.Utils.Murmur do

defp _murmur2(<<a::little-size(32), rest::binary>>, h) do
k = mask32(a * @m)
k = k ^^^ ubsr32(k, @r)
k = bxor(k, ubsr32(k, @r))
k = mask32(k * @m)
h = mask32(h * @m)
_murmur2(rest, h ^^^ k)

Check warning on line 60 in lib/kafka_ex/utils/murmur.ex

View workflow job for this annotation

GitHub Actions / check | setup dependencies (1.12.3, 24.3.4)

^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead

Check warning on line 60 in lib/kafka_ex/utils/murmur.ex

View workflow job for this annotation

GitHub Actions / Static Code Analysis (1.12.3, 24.3.4)

^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead

Check warning on line 60 in lib/kafka_ex/utils/murmur.ex

View workflow job for this annotation

GitHub Actions / Static Code Analysis (1.12.3, 24.3.4)

^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
end

defp _murmur2(<<a1::size(8), a2::size(8), a3::size(8)>>, h) do
_murmur2(<<a1, a2>>, h ^^^ mask32(a3 <<< 16))
_murmur2(<<a1, a2>>, bxor(h, mask32(a3 <<< 16)))
end

defp _murmur2(<<a1::size(8), a2::size(8)>>, h) do
_murmur2(<<a1>>, h ^^^ mask32(a2 <<< 8))
_murmur2(<<a1>>, bxor(h, mask32(a2 <<< 8)))
end

defp _murmur2(<<a1::size(8)>>, h) do
_murmur2("", mask32((h ^^^ a1) * @m))
_murmur2("", mask32((bxor(h, a1)) * @m))
end

defp _murmur2("", h) do
h = h ^^^ ubsr32(h, 13)
h = bxor(h, ubsr32(h, 13))
h = mask32(h * @m)
h ^^^ ubsr32(h, 15)
bxor(h, ubsr32(h, 15))
end
end

0 comments on commit bffd468

Please sign in to comment.