     s = e.width * 8
     <<e.code, value :: size(s)-signed>>
   end
-  def primitive_encoder(value, %Type{class: :primitive, name: "double"} = t, in_array) do
+  def primitive_encoder(value, %Type{class: :primitive, name: "double"}, in_array) do
     # float in Erlang/Elixir = double in IEEE 754
     if in_array, do: <<value :: float>>, else: <<0x82, value :: float>>
   end

    source_type = TypeManager.type_spec(t.source)
    [typed_encoder(value, t.descriptor), typed_encoder(value, source_type)]
  end
  def typed_encoder(_value, [%Descriptor{name: name} = d], _in_array) do
    # constructor = 0, descriptor name as string
    # Logger.info "encode descriptor with name #{inspect name}"
    [<<0x0>>, typed_encoder(name, TypeManager.type_spec("symbol"))]

  def primitive_encoder(value, %Type{class: :primitive, name: "boolean"}, true) do
    if value == true, do: <<1 :: size(8)>>, else: <<0 :: size(8)>>
  end
  def primitive_encoder(value, %Type{class: :primitive, name: "char"}, in_array) do
    if in_array, do: <<value :: utf32>>, else: <<0x73, value :: utf32>>
  end
  def primitive_encoder(value, %Type{class: :primitive, name: "timestamp"}, in_array) do
    # timestamp = 64 bit unsigned integer
    if in_array, do: <<value :: size(64)>>, else: <<0x83, value :: size(64)>>
  end
