123.2.3.4 is 4.3.2.123.in-addr.arpa.
356381
private static CharSequence convertReverseDNSIPv4(String str, int suffixStartIndex) throws AddressStringException {
		StringBuilder builder = new StringBuilder(suffixStartIndex);
		int segCount = 0;
		int j = suffixStartIndex;
		for(int i = suffixStartIndex - 1; i > 0; i--) {
			char c1 = str.charAt(i);
			if(c1 == IPv4Address.SEGMENT_SEPARATOR) {
				if(j - i <= 1) {
					throw new AddressStringException(str, i);
				}
				for(int k = i + 1; k < j; k++) {
					builder.append(str.charAt(k));
				}
				builder.append(c1);
				j = i;
				segCount++;
			}
		}
		for(int k = 0; k < j; k++) {
			builder.append(str.charAt(k));
		}
		if(segCount + 1 != IPv4Address.SEGMENT_COUNT) {
			throw new AddressStringException(str, 0);
		}
		return builder;
	}
216996
public void sendInteger4(int val) throws IOException {
    int4Buf[0] = (byte) (val >>> 24);
    int4Buf[1] = (byte) (val >>> 16);
    int4Buf[2] = (byte) (val >>> 8);
    int4Buf[3] = (byte) (val);
    pgOutput.write(int4Buf);
  }
662440
public function generateV4()
    {
        return sprintf('%04x%04x%04x%04x%04x%04x%04x%04x',
            // 32 bits for "time_low"
            mt_rand(0, 0xffff), mt_rand(0, 0xffff),

            // 16 bits for "time_mid"
            mt_rand(0, 0xffff),

            // 16 bits for "time_hi_and_version",
            // four most significant bits holds version number 4
            mt_rand(0, 0x0fff) | 0x4000,

            // 16 bits, 8 bits for "clk_seq_hi_res",
            // 8 bits for "clk_seq_low",
            // two most significant bits holds zero and one for variant DCE1.1
            mt_rand(0, 0x3fff) | 0x8000,

            // 48 bits for "node"
            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
    }
1352784
public static int aton(final byte[] addr)
	{
		int address = addr[3] & 0xFF;
		address |= ((addr[2] << 8) & 0xFF00);
		address |= ((addr[1] << 16) & 0xFF0000);
		address |= ((addr[0] << 24) & 0xFF000000);

		return address;
	}
984359
def systemInformationType4(ChannelDescription_presence=0,
                           MobileAllocation_presence=0):
    """"""
    a = L2PseudoLength()
    b = TpPd(pd=0x6)
    c = MessageType(mesType=0x1C)  # 000111100
    d = LocalAreaId()
    e = CellSelectionParameters()
    f = RachControlParameters()
    packet = a / b / c / d / e / f
    if ChannelDescription_presence is 1:
        g = ChannelDescriptionHdr(ieiCD=0x64, eightBitCD=0x0)
        packet = packet / g
    if MobileAllocation_presence is 1:
        h = MobileAllocationHdr(ieiMA=0x72, eightBitMA=0x0)
        packet = packet / h
    i = Si4RestOctets()
    packet = packet / i
    return packet
419028
void radf4(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset) {
		final double hsqt2 = 0.707106781186547572737310929369414225;
		int i, ic;
		double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4, w1r, w1i, w2r, w2i, w3r, w3i;
		int iw1, iw2, iw3;
		iw1 = offset;
		iw2 = offset + ido;
		iw3 = iw2 + ido;
		int idx0 = l1 * ido;
		for (int k = 0; k < l1; k++) {
			int idx1 = k * ido;
			int idx2 = 4 * idx1;
			int idx3 = idx1 + idx0;
			int idx4 = idx3 + idx0;
			int idx5 = idx4 + idx0;
			int idx6 = idx2 + ido;
			double i1r = in[in_off + idx1];
			double i2r = in[in_off + idx3];
			double i3r = in[in_off + idx4];
			double i4r = in[in_off + idx5];

			tr1 = i2r + i4r;
			tr2 = i1r + i3r;

			int oidx1 = out_off + idx2;
			int oidx2 = out_off + idx6 + ido;

			out[oidx1] = tr1 + tr2;
			out[oidx2 - 1 + ido + ido] = tr2 - tr1;
			out[oidx2 - 1] = i1r - i3r;
			out[oidx2] = i4r - i2r;
		}
		if (ido < 2)
			return;
		if (ido != 2) {
			for (int k = 0; k < l1; k++) {
				int idx1 = k * ido;
				int idx2 = idx1 + idx0;
				int idx3 = idx2 + idx0;
				int idx4 = idx3 + idx0;
				int idx5 = 4 * idx1;
				int idx6 = idx5 + ido;
				int idx7 = idx6 + ido;
				int idx8 = idx7 + ido;
				for (i = 2; i < ido; i += 2) {
					ic = ido - i;
					int widx1 = i - 1 + iw1;
					int widx2 = i - 1 + iw2;
					int widx3 = i - 1 + iw3;
					w1r = wtable_r[widx1 - 1];
					w1i = wtable_r[widx1];
					w2r = wtable_r[widx2 - 1];
					w2i = wtable_r[widx2];
					w3r = wtable_r[widx3 - 1];
					w3i = wtable_r[widx3];

					int idx9 = in_off + i;
					int idx10 = out_off + i;
					int idx11 = out_off + ic;
					int iidx1 = idx9 + idx1;
					int iidx2 = idx9 + idx2;
					int iidx3 = idx9 + idx3;
					int iidx4 = idx9 + idx4;

					double i1i = in[iidx1 - 1];
					double i1r = in[iidx1];
					double i2i = in[iidx2 - 1];
					double i2r = in[iidx2];
					double i3i = in[iidx3 - 1];
					double i3r = in[iidx3];
					double i4i = in[iidx4 - 1];
					double i4r = in[iidx4];

					cr2 = w1r * i2i + w1i * i2r;
					ci2 = w1r * i2r - w1i * i2i;
					cr3 = w2r * i3i + w2i * i3r;
					ci3 = w2r * i3r - w2i * i3i;
					cr4 = w3r * i4i + w3i * i4r;
					ci4 = w3r * i4r - w3i * i4i;
					tr1 = cr2 + cr4;
					tr4 = cr4 - cr2;
					ti1 = ci2 + ci4;
					ti4 = ci2 - ci4;
					ti2 = i1r + ci3;
					ti3 = i1r - ci3;
					tr2 = i1i + cr3;
					tr3 = i1i - cr3;

					int oidx1 = idx10 + idx5;
					int oidx2 = idx11 + idx6;
					int oidx3 = idx10 + idx7;
					int oidx4 = idx11 + idx8;

					out[oidx1 - 1] = tr1 + tr2;
					out[oidx4 - 1] = tr2 - tr1;
					out[oidx1] = ti1 + ti2;
					out[oidx4] = ti1 - ti2;
					out[oidx3 - 1] = ti4 + tr3;
					out[oidx2 - 1] = tr3 - ti4;
					out[oidx3] = tr4 + ti3;
					out[oidx2] = tr4 - ti3;
				}
			}
			if (ido % 2 == 1)
				return;
		}
		for (int k = 0; k < l1; k++) {
			int idx1 = k * ido;
			int idx2 = 4 * idx1;
			int idx3 = idx1 + idx0;
			int idx4 = idx3 + idx0;
			int idx5 = idx4 + idx0;
			int idx6 = idx2 + ido;
			int idx7 = idx6 + ido;
			int idx8 = idx7 + ido;
			int idx9 = in_off + ido;
			int idx10 = out_off + ido;

			double i1i = in[idx9 - 1 + idx1];
			double i2i = in[idx9 - 1 + idx3];
			double i3i = in[idx9 - 1 + idx4];
			double i4i = in[idx9 - 1 + idx5];

			ti1 = -hsqt2 * (i2i + i4i);
			tr1 = hsqt2 * (i2i - i4i);

			out[idx10 - 1 + idx2] = tr1 + i1i;
			out[idx10 - 1 + idx7] = i1i - tr1;
			out[out_off + idx6] = ti1 - i3i;
			out[out_off + idx8] = ti1 + i3i;
		}
	}
962858
function addressFor(network, rnd) {
  var version = PROTOCOL_VERSIONS[network];

  //                      ver   payload  checksum
  var packed = new Buffer('00' + rnd + '00112233', 'hex');

  packed[0] = version;

  var hash = crypto.createHash('sha256').update(packed.slice(0, packed.length - 4)).digest();

  hash = crypto.createHash('sha256').update(hash).digest();

  packed[packed.length - 4] = hash[0];
  packed[packed.length - 3] = hash[1];
  packed[packed.length - 2] = hash[2];
  packed[packed.length - 1] = hash[3];

  return base58(packed);
}
761337
def _ipv4_to_bits(ipaddr):
    '''
    
    '''
    return ''.join([bin(int(x))[2:].rjust(8, '0') for x in ipaddr.split('.')])
381778
function(x, y) {
  var ip,
    bits,
    arr,
    ip4,
    ip6;
  if (y === undefined) { // handed a string
    arr = x.split('/');
    this.subnet = arr[1];
    ip = arr[0];
  } else {
    this.subnet = y;
    ip = x;
  }


  ip4 = (ip instanceof Address4 ? ip : new Address4(ip));
  ip6 = (ip instanceof Address6 ? ip : new Address6(ip));

  this.v = (ip4.valid ? 4 : (ip6.valid ? 6 : 0));

  if (this.v === 6) {
    bits = 128;
  } else {
    bits = 32;
  }
  ip = makeAddr(ip, this.v);

  this.mask = generateCidrMask(bits, bits - this.subnet - 1);
  this.prefix = generatePrefix(ip, this.mask);
}
881185
def theU238_alpha
      array = Array.new(23)

      array[0] = 1.2311E+0
      array[1] = 1.1486E+0
      array[2] = 7.0701E-01
      array[3] = 2.5209E-01
      array[4] = 7.187E-02
      array[5] = 2.8291E-02
      array[6] = 6.8382E-03
      array[7] = 1.2322E-03
      array[8] = 6.8409E-04
      array[9] = 1.6975E-04
      array[10] = 2.4182E-05
      array[11] = 6.6356E-06
      array[12] = 1.0075E-06
      array[13] = 4.9894E-07
      array[14] = 1.6352E-07
      array[15] = 2.3355E-08
      array[16] = 2.8094E-09
      array[17] = 3.6236E-11
      array[18] = 6.4577E-11
      array[19] = 4.4963E-14
      array[20] = 3.6654E-16
      array[21] = 5.6293E-17
      array[22] = 7.1602E-17

      array
    end
1013045
private static int findVersion(final ByteBuf buffer) {
        final int n = buffer.readableBytes();
        // per spec, the version number is found in the 13th byte
        if (n < 13) {
            return -1;
        }

        int idx = buffer.readerIndex();
        return match(BINARY_PREFIX, buffer, idx) ? buffer.getByte(idx + BINARY_PREFIX_LENGTH) : 1;
    }
763774
def d2BinaryRochedx2(r, D, q, F):
    
    return (2*r[0]*r[0]-r[1]*r[1]-r[2]*r[2])/(r[0]*r[0]+r[1]*r[1]+r[2]*r[2])**2.5 +\
          q*(2*(r[0]-D)*(r[0]-D)-r[1]*r[1]-r[2]*r[2])/((r[0]-D)*(r[0]-D)+r[1]*r[1]+r[2]*r[2])**2.5 +\
          F*F*(1+q)
356458
def _get_binary_from_ipv4(self, ip_addr):
        """"""

        return struct.unpack("!L", socket.inet_pton(socket.AF_INET,
                                                    ip_addr))[0]
1347473
private static boolean isIPv4MappedAddress(final byte[] addr) {
    if (addr.length < INADDR16SZ) {
      return false;
    }
    return addr[0] == 0x00 && addr[1] == 0x00 && addr[2] == 0x00 && addr[3] == 0x00
        && addr[4] == 0x00 && addr[5] == 0x00 && addr[6] == 0x00 && addr[7] == 0x00
        && addr[8] == 0x00 && addr[9] == 0x00 && addr[10] == (byte) 0xff && addr[11] == (byte) 0xff;
  }
1096976
public static int getAddressOutboundness(String address) {
		if(address.startsWith("127.0")) return 0;
		if(address.startsWith("192.168")) return 1;
		if(address.startsWith("10.")) return 2;
		if(address.startsWith("172.16") || address.startsWith("172.17") || address.startsWith("172.18") 
				|| address.startsWith("172.19") || address.startsWith("172.20") || address.startsWith("172.21") 
				|| address.startsWith("172.22") || address.startsWith("172.23") || address.startsWith("172.24")
				|| address.startsWith("172.25") || address.startsWith("172.26") || address.startsWith("172.27")
				|| address.startsWith("172.28") || address.startsWith("172.29") || address.startsWith("172.30")
				|| address.startsWith("172.31")) return 3;
		if(address.indexOf(".")>0) return 4; // match IPv4 addresses heuristically
		return -1; // matches IPv6 or something malformed;
	}
465741
def theU235_alpha
      array = Array.new(23)

      array[0] = 6.5057E-01
      array[1] = 5.1264E-01
      array[2] = 2.4384E-01
      array[3] = 1.3850E-01
      array[4] = 5.544E-02
      array[5] = 2.2225E-02
      array[6] = 3.3088E-03
      array[7] = 9.3015E-04
      array[8] = 8.0943E-04
      array[9] = 1.9567E-04
      array[10] = 3.2535E-05
      array[11] = 7.5595E-06
      array[12] = 2.5232E-06
      array[13] = 4.9948E-07
      array[14] = 1.8531E-07
      array[15] = 2.6608E-08
      array[16] = 2.2398E-09
      array[17] = 8.1641E-12
      array[18] = 8.7797E-11
      array[19] = 2.5131E-14
      array[20] = 3.2176E-16
      array[21] = 4.5038E-17
      array[22] = 7.4791E-17

      array
    end
799300
def _find_ip4_broadcast_addresses():
    
    yield "255.255.255.255"
    for interface in netifaces.interfaces():
        ifaddresses = netifaces.ifaddresses(interface)
        for family in ifaddresses:
            if family == netifaces.AF_INET:
                address_info = ifaddresses[family]
                for info in address_info:
                    if "broadcast" in info:
                        yield info['broadcast']