Skip to content

Commit

Permalink
perf(compile): reduce else statement
Browse files Browse the repository at this point in the history
  • Loading branch information
rewhile committed Sep 7, 2023
1 parent 9f60e81 commit a937d54
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lua/catppuccin/lib/hashing.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local M = {}
local B = bit or bit32 or require "catppuccin.lib.vim.bit"

local hash_str = function(str) -- djb2, https://stackoverflow.com/a/7666577/12356622
local hash_str = function(str) -- djb2, https://theartincode.stanis.me/008-djb2/
local hash = 5381
for i = 1, #str do
hash = B.lshift(hash, 5) + hash + string.byte(str, i)
Expand All @@ -19,9 +19,8 @@ function M.hash(v) -- Xor hashing: https://codeforces.com/blog/entry/85900
return hash
elseif t == "function" then
return hash_str(string.dump(v))
else
return tostring(v)
end
return tostring(v)
end

return M

0 comments on commit a937d54

Please sign in to comment.