diff options
Diffstat (limited to 'llmc/header.go')
| -rw-r--r-- | llmc/header.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llmc/header.go b/llmc/header.go new file mode 100644 index 0000000..a154ae5 --- /dev/null +++ b/llmc/header.go @@ -0,0 +1,21 @@ +package llmc + +import "encoding/binary" + +const headerWords = 256 + +type Header struct { + Magic int32 + Version int32 + NumToks int32 +} + +func (h Header) encode() [headerWords * 4]byte { + var buffer [headerWords * 4]byte + + binary.LittleEndian.PutUint32(buffer[0:], uint32(h.Magic)) + binary.LittleEndian.PutUint32(buffer[4:], uint32(h.Version)) + binary.LittleEndian.PutUint32(buffer[8:], uint32(h.NumToks)) + + return buffer +} |
