Skip to content

Commit

Permalink
Use a StaticArray instead of Bytes slice
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Dec 13, 2022
1 parent 87840f8 commit a5331b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/socket/address.cr
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ class Socket
addr.s_addr & 0x000000ff_u32 == 0x0000007f_u32
in LibC::In6Addr
addr8 = ipv6_addr8(addr)
addr8 == StaticArray[0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 1_u8] || # "::1"
addr8.to_slice[0, 13] == Bytes[0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 255_u8, 255_u8, 127_u8] # "::ffff:127.0.0.1/104"
addr8 == StaticArray[0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 1_u8] || # "::1"
addr8.to_slice[0, 13] == StaticArray[0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 0_u8, 255_u8, 255_u8, 127_u8].to_slice # "::ffff:127.0.0.1/104"
end
end

Expand Down

0 comments on commit a5331b7

Please sign in to comment.