首页 > 代码库 > 用计算器(程序员)计算IP地址

用计算器(程序员)计算IP地址

DWORD ip = 3408138412


输入ip和255“相与”:

3408138412 And 255  =172;

输入ip右移8位,再和255“相与”:

3408138412 Rsh 8 And 255 = 16;

输入ip右移16位,再和255“相与”:

3408138412 Rsh 16 And 255 = 36;

输入ip右移24位,再和255“相与”:

3408138412 Rsh 24 And 255 = 203;


 ip1&0xff, (ip1>>8)&0xff,(ip1>>16)&0xff,(ip1>>24)&0xff