From 28cf3aa0c74f5bb5a934f2ea9e3878ce1bf82e22 Mon Sep 17 00:00:00 2001 From: v2ray Date: Mon, 23 May 2016 20:16:31 +0200 Subject: [PATCH] uint32 --- common/serial/numbers.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common/serial/numbers.go b/common/serial/numbers.go index d186ba60..fe596563 100644 --- a/common/serial/numbers.go +++ b/common/serial/numbers.go @@ -46,6 +46,26 @@ func (this IntLiteral) Bytes() []byte { } } +type Uint32Literal uint32 + +func (this Uint32Literal) String() string { + return strconv.FormatUint(uint64(this.Value()), 10) +} + +func (this Uint32Literal) Value() uint32 { + return uint32(this) +} + +func (this Uint32Literal) Bytes() []byte { + value := this.Value() + return []byte{ + byte(value >> 24), + byte(value >> 16), + byte(value >> 8), + byte(value), + } +} + type Int64Literal int64 func (this Int64Literal) String() string {