mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-04 16:25:21 -05:00
bytes to number methods
This commit is contained in:
@@ -10,17 +10,6 @@ type Uint16 interface {
|
||||
|
||||
type Uint16Literal uint16
|
||||
|
||||
func ParseUint16(data []byte) Uint16Literal {
|
||||
switch len(data) {
|
||||
case 0:
|
||||
return Uint16Literal(0)
|
||||
case 1:
|
||||
return Uint16Literal(uint16(data[0]))
|
||||
default:
|
||||
return Uint16Literal(uint16(data[0])<<8 + uint16(data[1]))
|
||||
}
|
||||
}
|
||||
|
||||
func (this Uint16Literal) String() string {
|
||||
return strconv.Itoa(int(this))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user