From c99cbdbe58f7817a2ee6064e72db25fc1d067b41 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Wed, 21 Sep 2016 16:52:55 +0200 Subject: Emit BufferBlob for array[int8] --- sys/decl.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sys/decl.go') diff --git a/sys/decl.go b/sys/decl.go index f792f541c..275bbb380 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -100,7 +100,8 @@ func (t FileoffType) Align() uintptr { type BufferKind int const ( - BufferBlob BufferKind = iota + BufferBlobRand BufferKind = iota + BufferBlobRange BufferString BufferSockaddr BufferFilesystem @@ -110,7 +111,9 @@ const ( type BufferType struct { TypeCommon - Kind BufferKind + Kind BufferKind + RangeBegin uintptr // for BufferBlobRange kind + RangeEnd uintptr // for BufferBlobRange kind } func (t BufferType) Size() uintptr { @@ -119,6 +122,11 @@ func (t BufferType) Size() uintptr { return 14 case BufferAlgName: return 64 + case BufferBlobRange: + if t.RangeBegin == t.RangeEnd { + return t.RangeBegin + } + fallthrough default: panic(fmt.Sprintf("buffer size is not statically known: %v", t.Name())) } -- cgit mrf-deployment