/usr/share/gocode/src/github.com/calmh/xdr/bench_xdr_test.go is in golang-github-calmh-xdr-dev 2.0.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | // ************************************************************
// This file is automatically generated by genxdr. Do not edit.
// ************************************************************
package xdr_test
import (
"github.com/calmh/xdr"
)
/*
XDRBenchStruct Structure:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ I1 (64 bits) +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| I2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 16 zero bits | I3 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 24 zero bits | I4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ Bs0 (length + padded data) \
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ Bs1 (length + padded data) \
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Number of Is0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
| Is0 (n items) |
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ S0 (length + padded data) \
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ S1 (length + padded data) \
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct XDRBenchStruct {
unsigned hyper I1;
unsigned int I2;
unsigned int I3;
unsigned int I4;
opaque Bs0<128>;
opaque Bs1<>;
int Is0<>;
string S0<128>;
string S1<>;
}
*/
func (o XDRBenchStruct) XDRSize() int {
return 8 + 4 + 4 + 4 +
4 + len(o.Bs0) + xdr.Padding(len(o.Bs0)) +
4 + len(o.Bs1) + xdr.Padding(len(o.Bs1)) +
4 + len(o.Is0)*4 +
4 + len(o.S0) + xdr.Padding(len(o.S0)) +
4 + len(o.S1) + xdr.Padding(len(o.S1))
}
func (o XDRBenchStruct) MarshalXDR() ([]byte, error) {
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
}
func (o XDRBenchStruct) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
func (o XDRBenchStruct) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalUint64(o.I1)
m.MarshalUint32(o.I2)
m.MarshalUint16(o.I3)
m.MarshalUint8(o.I4)
if l := len(o.Bs0); l > 128 {
return xdr.ElementSizeExceeded("Bs0", l, 128)
}
m.MarshalBytes(o.Bs0)
m.MarshalBytes(o.Bs1)
m.MarshalUint32(uint32(len(o.Is0)))
for i := range o.Is0 {
m.MarshalUint32(uint32(o.Is0[i]))
}
if l := len(o.S0); l > 128 {
return xdr.ElementSizeExceeded("S0", l, 128)
}
m.MarshalString(o.S0)
m.MarshalString(o.S1)
return m.Error
}
func (o *XDRBenchStruct) UnmarshalXDR(bs []byte) error {
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
}
func (o *XDRBenchStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.I1 = u.UnmarshalUint64()
o.I2 = u.UnmarshalUint32()
o.I3 = u.UnmarshalUint16()
o.I4 = u.UnmarshalUint8()
o.Bs0 = u.UnmarshalBytesMax(128)
o.Bs1 = u.UnmarshalBytes()
_Is0Size := int(u.UnmarshalUint32())
if _Is0Size < 0 {
return xdr.ElementSizeExceeded("Is0", _Is0Size, 0)
} else if _Is0Size == 0 {
o.Is0 = nil
} else {
if _Is0Size <= len(o.Is0) {
o.Is0 = o.Is0[:_Is0Size]
} else {
o.Is0 = make([]int32, _Is0Size)
}
for i := range o.Is0 {
o.Is0[i] = int32(u.UnmarshalUint32())
}
}
o.S0 = u.UnmarshalStringMax(128)
o.S1 = u.UnmarshalString()
return u.Error
}
|