summaryrefslogtreecommitdiff
path: root/llmc/header.go
diff options
context:
space:
mode:
authorJonas Knobloch <jonas.knobloch@t-online.de>2026-04-22 15:36:58 +0200
committerJonas Knobloch <jonas.knobloch@t-online.de>2026-04-23 20:17:53 +0200
commitbabd70eb9d4e4b028c0eb8c32e6bed65dafa0481 (patch)
tree75635ad8e0ef6541b7b5d6926f529830b32f715b /llmc/header.go
parent54b11da0d2f853395f270379044674363b1a124a (diff)
Add llmc module
Diffstat (limited to 'llmc/header.go')
-rw-r--r--llmc/header.go21
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
+}