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.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/rrdformat/rrdbinary/types.go b/rrdformat/rrdbinary/types.go
index a6fa881..47df26e 100644
--- a/rrdformat/rrdbinary/types.go
+++ b/rrdformat/rrdbinary/types.go
@@ -9,32 +9,32 @@ import (
type Architecture struct {
ByteOrder binary.ByteOrder
// C `double`
- FloatWidth int // always 8 -- we assume IEEE 754 doubles
- FloatAlign int
+ DoubleWidth int // always 8 -- we assume IEEE 754 doubles
+ DoubleAlign int
// C `long` or `unsigned long`
- IntWidth int
- IntAlign int
+ LongWidth int
+ LongAlign int
// C `union { unsigned long; double; }`
- UnivalWidth int // max(FloatWidth, IntWidth)
- UnivalAlign int // max(FloatAlign, IntAlign)
+ UnivalWidth int // max(DoubleWidth, LongWidth)
+ UnivalAlign int // max(DoubleAlign, LongAlign)
// C `time_t`
TimeWidth int
TimeAlign int
}
-type String string // \0-terminated
-type Float float64 // 8 bytes
-type Uint uint64 // 4 or 8 bytes
-type Int int64 // 4 or 8 bytes
-type Unival uint64 // 8 bytes
-type Time int64 // 4 or 8 bytes, only has second-precision
-type EOF struct{} // 0 bytes
+type String string // \0-terminated
+type Double float64 // 8 bytes
+type ULong uint64 // 4 or 8 bytes
+type Long int64 // 4 or 8 bytes
+type Unival uint64 // 8 bytes
+type Time int64 // 4 or 8 bytes, only has second-precision
+type EOF struct{} // 0 bytes
func (u Unival) AsUint64() uint64 { return uint64(u) }
func (u Unival) AsFloat64() float64 { return math.Float64frombits(uint64(u)) }
// MarshalJSON is for my own debugging.
-func (f Float) MarshalJSON() ([]byte, error) {
+func (f Double) MarshalJSON() ([]byte, error) {
raw := float64(f)
if math.IsNaN(raw) {
return json.Marshal("NaN")
@@ -45,9 +45,9 @@ func (f Float) MarshalJSON() ([]byte, error) {
// Statically assert that each of the above types implements the
// 'unmarshaler' interface.
var _ unmarshaler = func() *String { return nil }()
-var _ unmarshaler = func() *Float { return nil }()
-var _ unmarshaler = func() *Uint { return nil }()
-var _ unmarshaler = func() *Int { return nil }()
+var _ unmarshaler = func() *Double { return nil }()
+var _ unmarshaler = func() *ULong { return nil }()
+var _ unmarshaler = func() *Long { return nil }()
var _ unmarshaler = func() *Unival { return nil }()
var _ unmarshaler = func() *Time { return nil }()
var _ unmarshaler = func() *EOF { return nil }()