Skip to content

Commit

Permalink
Break tail call in htonl
Browse files Browse the repository at this point in the history
  • Loading branch information
dpino committed Sep 6, 2017
1 parent fce8dd4 commit 57e5b28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ if ffi.abi("be") then
function htons(b) return b end
else
-- htonl is unsigned, matching the C version and expectations.
function htonl(b) return tonumber(cast('uint32_t', bswap(b))) end
function htons(b) return rshift(bswap(b), 16) end
function htonl(b) return (tonumber(cast('uint32_t', bswap(b)))) end
function htons(b) return (rshift(bswap(b), 16)) end
end
ntohl = htonl
ntohs = htons
Expand Down

0 comments on commit 57e5b28

Please sign in to comment.