I need to calculate the netmask given a Start and End ip address for a block in a subnet, in javascript. I leveraged this answer https://stackoverflow.com/a/8872819/664479 and
With a startAddress of ac164980
and endAddress of ac16498e
var scope = ipScope;
var s = parseInt("0x"+startAddress ,16);
var e = parseInt("0x"+endAddress ,16);
var m = parseInt("0xFFFFFFFF",16);
var nm = ""+(m ^ s ^ e);
I expected FFFFFFC0
but got -15
Where'd I go wrong?