Files
native/proto/col_uint32_unsafe_gen.go
zeekay 765c3d0aa1 hanzo-ds/native: de-branded native protocol lib (fork of clickhouse ch-go v0.71.0)
Module path, package names, and identifiers de-branded to native/proto/compress/
pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used
by hanzo-ds/go (proto + compress).
2026-07-10 13:10:07 -07:00

61 lines
1.2 KiB
Go

//go:build (amd64 || arm64 || riscv64) && !purego
// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
package proto
import (
"unsafe"
"github.com/go-faster/errors"
)
// DecodeColumn decodes UInt32 rows from *Reader.
func (c *ColUInt32) DecodeColumn(r *Reader, rows int) error {
if rows == 0 {
return nil
}
*c = append(*c, make([]uint32, rows)...)
s := *(*slice)(unsafe.Pointer(c))
const size = 32 / 8
s.Len *= size
s.Cap *= size
dst := *(*[]byte)(unsafe.Pointer(&s))
if err := r.ReadFull(dst); err != nil {
return errors.Wrap(err, "read full")
}
return nil
}
// EncodeColumn encodes UInt32 rows to *Buffer.
func (c ColUInt32) EncodeColumn(b *Buffer) {
v := c
if len(v) == 0 {
return
}
offset := len(b.Buf)
const size = 32 / 8
b.Buf = append(b.Buf, make([]byte, size*len(v))...)
s := *(*slice)(unsafe.Pointer(&v))
s.Len *= size
s.Cap *= size
src := *(*[]byte)(unsafe.Pointer(&s))
dst := b.Buf[offset:]
copy(dst, src)
}
func (c ColUInt32) WriteColumn(w *Writer) {
v := c
if len(v) == 0 {
return
}
const size = 32 / 8
s := *(*slice)(unsafe.Pointer(&v))
s.Len *= size
s.Cap *= size
src := *(*[]byte)(unsafe.Pointer(&s))
w.ChainWrite(src)
}