diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-22 15:36:58 +0200 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-23 20:17:53 +0200 |
| commit | babd70eb9d4e4b028c0eb8c32e6bed65dafa0481 (patch) | |
| tree | 75635ad8e0ef6541b7b5d6926f529830b32f715b /llmc/header.go | |
| parent | 54b11da0d2f853395f270379044674363b1a124a (diff) | |
Add llmc module
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 +} |
