Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for xtoi2 (0.41 sec)

  1. src/net/mac.go

    			var ok bool
    			if hw[i], ok = xtoi2(s[x:], s[2]); !ok {
    				goto error
    			}
    			x += 3
    		}
    	} else if s[4] == '.' {
    		if (len(s)+1)%5 != 0 {
    			goto error
    		}
    		n := 2 * (len(s) + 1) / 5
    		if n != 6 && n != 8 && n != 20 {
    			goto error
    		}
    		hw = make(HardwareAddr, n)
    		for x, i := 0, 0; i < n; i += 2 {
    			var ok bool
    			if hw[i], ok = xtoi2(s[x:x+2], 0); !ok {
    				goto error
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 1.9K bytes
    - Viewed (0)
  2. src/net/parse.go

    	}
    	return n, i, true
    }
    
    // xtoi2 converts the next two hex digits of s into a byte.
    // If s is longer than 2 bytes then the third byte must be e.
    // If the first two bytes of s are not hex digits or the third byte
    // does not match e, false is returned.
    func xtoi2(s string, e byte) (byte, bool) {
    	if len(s) > 2 && s[2] != e {
    		return 0, false
    	}
    	n, ei, ok := xtoi(s[:2])
    	return byte(n), ok && ei == 2
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 14:00:54 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  3. src/net/interface_linux.go

    			if ifi == nil || name == ifi.Name {
    				// The Linux kernel puts the IP
    				// address in /proc/net/igmp in native
    				// endianness.
    				for i := 0; i+1 < len(f[0]); i += 2 {
    					b[i/2], _ = xtoi2(f[0][i:i+2], 0)
    				}
    				i := *(*uint32)(unsafe.Pointer(&b[:4][0]))
    				ifma := &IPAddr{IP: IPv4(byte(i>>24), byte(i>>16), byte(i>>8), byte(i))}
    				ifmat = append(ifmat, ifma)
    			}
    		}
    	}
    	return ifmat
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Aug 27 05:42:03 UTC 2022
    - 7K bytes
    - Viewed (0)
  4. src/net/interface_plan9.go

    		}
    
    		if len(line) > 0 && len(line)%2 == 0 {
    			ifc.HardwareAddr = make([]byte, len(line)/2)
    			var ok bool
    			for i := range ifc.HardwareAddr {
    				j := (i + 1) * 2
    				ifc.HardwareAddr[i], ok = xtoi2(line[i*2:j], 0)
    				if !ok {
    					ifc.HardwareAddr = ifc.HardwareAddr[:i]
    					break
    				}
    			}
    		}
    
    		ifc.Flags = FlagUp | FlagRunning | FlagBroadcast | FlagMulticast
    	} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 14:00:54 UTC 2024
    - 4.7K bytes
    - Viewed (0)
Back to top