summaryrefslogtreecommitdiff
path: root/rrdformat/rrdbinary/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'rrdformat/rrdbinary/types.go')
-rw-r--r--rrdformat/rrdbinary/types.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/rrdformat/rrdbinary/types.go b/rrdformat/rrdbinary/types.go
new file mode 100644
index 0000000..cbe3e2d
--- /dev/null
+++ b/rrdformat/rrdbinary/types.go
@@ -0,0 +1,27 @@
+package rrdbinary
+
+import (
+ "encoding/binary"
+ "math"
+)
+
+type Architecture struct {
+ ByteOrder binary.ByteOrder
+ // C `double`
+ FloatWidth int // always 8
+ FloatAlign int
+ // C `unsigned long`
+ UintWidth int
+ UintAlign int
+ // C `union { unsigned long; double; }`
+ UnivalWidth int // max(FloatWidth, IntWidth)
+ UnivalAlign int // max(FloatAlign, IntAlign)
+}
+
+type String string // \0-terminatd
+type Float float64 // 8 bytes
+type Uint uint64 // 4 or 8 bytes
+type Unival uint64 // 8 bytes
+
+func (u Unival) AsUint64() uint64 { return uint64(u) }
+func (u Unival) AsFloat64() float64 { return math.Float64frombits(uint64(u)) }