aboutsummaryrefslogtreecommitdiffstats
path: root/sys/decl.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-10-04 18:55:45 +0200
committerGitHub <noreply@github.com>2016-10-04 18:55:45 +0200
commit42d90e9394c8f4e06b46a65f1e3f932a1e4fc3d1 (patch)
treea1c278f4d18496efbbcaf21dc541e09c588710a3 /sys/decl.go
parente73ddfcb3ac418fc690b982f70da15b898096fa5 (diff)
parentf2d77726c8e7d2662bda0414d55073cd51742ff3 (diff)
Merge pull request #77 from xairy/array_as_blob
Emit BufferBlob for array[int8]
Diffstat (limited to 'sys/decl.go')
-rw-r--r--sys/decl.go12
1 files changed, 10 insertions, 2 deletions
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()))
}