MCPcopy Create free account
hub / github.com/questdb/questdb / getBroadcastAddress

Method getBroadcastAddress

core/src/main/java/io/questdb/std/Numbers.java:853–861  ·  view source on GitHub ↗
(CharSequence sequence)

Source from the content-addressed store, hash-verified

851
852 // returns lo | hi network address in a single long
853 public static long getBroadcastAddress(CharSequence sequence) throws NumericException {
854 long subnetAndNetmask = Numbers.getIPv4Subnet(sequence);
855 int subnet = (int) (subnetAndNetmask >> 32);
856 int netmask = (int) (subnetAndNetmask);
857 // sets all remaining bits to the right of the subnet
858 int broadcastAddress = subnet | ~(0xffffffff << (32 - getNetmaskLength(netmask)));
859
860 return pack(subnet & netmask, broadcastAddress);
861 }
862
863 // returns network mask, e.g. 255.0.0.0 == /8 or Numbers.BAD_NETMASK on error
864 public static int getIPv4Netmask(CharSequence sequence) {

Callers 6

newInstanceMethod · 0.95

Calls 3

getIPv4SubnetMethod · 0.95
getNetmaskLengthMethod · 0.95
packMethod · 0.95

Tested by 5