1
0
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:
v2ray
2016-01-24 22:28:44 +01:00
parent 96f582da98
commit 2b1441b030
4 changed files with 20 additions and 13 deletions

View File

@@ -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))
}