Exemplo n.º 1
0
func SliceByteToUInt8List(seg *capn.Segment, m []byte) capn.UInt8List {
	lst := seg.NewUInt8List(len(m))
	for i := range m {
		lst.Set(i, uint8(m[i]))
	}
	return lst
}
Exemplo n.º 2
0
func HashTableGoToCapn(seg *capn.Segment, src *HashTable) HashTableCapn {
	dest := AutoNewHashTableCapn(seg)
	dest.SetCellSz(uint64(src.CellSz))
	dest.SetArraySize(uint64(src.ArraySize))
	dest.SetPopulation(uint64(src.Population))

	mylist1 := seg.NewUInt8List(len(src.Offheap))
	for i := range src.Offheap {
		mylist1.Set(i, uint8(src.Offheap[i]))
	}
	dest.SetOffheap(mylist1.ToArray())

	return dest
}
Exemplo n.º 3
0
func MmapMallocGoToCapn(seg *capn.Segment, src *MmapMalloc) MmapMallocCapn {
	dest := AutoNewMmapMallocCapn(seg)
	dest.SetPath(src.Path)
	dest.SetFd(int64(src.Fd))
	dest.SetFileBytesLen(src.FileBytesLen)
	dest.SetBytesAlloc(src.BytesAlloc)

	mylist1 := seg.NewUInt8List(len(src.Mem))
	for i := range src.Mem {
		mylist1.Set(i, uint8(src.Mem[i]))
	}
	dest.SetMem(mylist1.ToArray())

	return dest
}