Skip to content

Instantly share code, notes, and snippets.

@ton31337
Created November 27, 2017 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ton31337/d9174013d164ff24a7a436bfee564402 to your computer and use it in GitHub Desktop.
Save ton31337/d9174013d164ff24a7a436bfee564402 to your computer and use it in GitHub Desktop.
def ipv6_int(ip)
ip_int = 0.to_big_i
ip.split(':').each_with_index do |word, i|
ip_int |= word.to_big_i << (128 - 16 * (i + 1))
end
ip_int
end
Invalid BigInt: 2a02 (ArgumentError)
0x459877: *CallStack::unwind:Array(Pointer(Void)) at ??
0x49ed14: initialize at /opt/crystal/src/big/big_int.cr 36:5
0x49ec82: new at /opt/crystal/src/big/big_int.cr 31:3
0x46e54b: to_big_i at /opt/crystal/src/big/big_int.cr 459:5
0x46e510: to_big_i at /opt/crystal/src/big/big_int.cr 458:3
0x45704f: ipv6_int at /opt/razor/a.cr 23:15
0x456f02: ip_hashed at /opt/razor/a.cr 30:5
0x447889: __crystal_main at /opt/razor/a.cr 36:3
0x456d79: main at /opt/crystal/src/main.cr 12:15
0x7f58544afb15: __libc_start_main at ??
0x4470fd: ??? at ??
0x0: ??? at ??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment