From 3b11093a32fa012ee176f77186f80a315ff7f445 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sun, 25 Sep 2016 00:30:33 -0400 Subject: [PATCH] coord --- ent/float.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ent/float.go b/ent/float.go index 530a4d7..5601ba6 100644 --- a/ent/float.go +++ b/ent/float.go @@ -22,7 +22,10 @@ func floatType(spec *typeSpec, env *Env) tÿpe { return nil } if spec.encoder == "coord" { - return nil + Debug.Printf(" coord float type") + return typeFn(func(r bit.Reader) (value, error) { + return bit.ReadCoord(r), r.Err() + }) } if spec.serializer == "simulationtime" { return nil @@ -30,7 +33,10 @@ func floatType(spec *typeSpec, env *Env) tÿpe { switch spec.bits { case 0, 32: Debug.Printf(" std float type") - return typeFn(float_t) + return typeFn(func(r bit.Reader) (value, error) { + // TODO: check uint32 overflow here? + return math.Float32frombits(uint32(r.ReadBits(32))), r.Err() + }) default: return qFloatType(spec, env) } @@ -81,8 +87,3 @@ func (t qfloat_t) read(r bit.Reader) (value, error) { } return t.low + float32(r.ReadBits(t.bits))*t.interval, r.Err() } - -func float_t(r bit.Reader) (value, error) { - // TODO: check uint32 overflow here? - return math.Float32frombits(uint32(r.ReadBits(32))), r.Err() -}