Created
April 3, 2015 04:12
-
-
Save puterjam/cded826b5b0f8b9b87d2 to your computer and use it in GitHub Desktop.
ip2long long2ip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ip2long = function(ip){ip = ip.split(".");return (((ip[0] << 24) | (ip[1] << 16) | (ip[2] << 8) | ip[3]) >>> 0)} | |
var long2ip = function(ip){return [(ip >> 24) & 0xff,(ip >> 16) & 0xff,(ip >> 8) & 0xff,ip & 0xff].join(".")} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment