From 58358ddd7cd0152bf16a7326e1d595524fb51246 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 8 Dec 2015 13:38:43 -0500 Subject: Some refactoring --- .../src/gopkg.in/asn1-ber.v1/content_int.go | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Godeps/_workspace/src/gopkg.in/asn1-ber.v1/content_int.go (limited to 'Godeps/_workspace/src/gopkg.in/asn1-ber.v1/content_int.go') diff --git a/Godeps/_workspace/src/gopkg.in/asn1-ber.v1/content_int.go b/Godeps/_workspace/src/gopkg.in/asn1-ber.v1/content_int.go new file mode 100644 index 000000000..1858b74b6 --- /dev/null +++ b/Godeps/_workspace/src/gopkg.in/asn1-ber.v1/content_int.go @@ -0,0 +1,25 @@ +package ber + +func encodeUnsignedInteger(i uint64) []byte { + n := uint64Length(i) + out := make([]byte, n) + + var j int + for ; n > 0; n-- { + out[j] = (byte(i >> uint((n-1)*8))) + j++ + } + + return out +} + +func uint64Length(i uint64) (numBytes int) { + numBytes = 1 + + for i > 255 { + numBytes++ + i >>= 8 + } + + return +} -- cgit v1.2.3-1-g7c22