@@ -117,6 +117,8 @@ impl From<DynInteger> for DynValue<'_> {
117117#[ derive( Copy , Clone , PartialEq ) ]
118118pub enum DynScalar {
119119 Integer ( DynInteger ) ,
120+ #[ cfg( feature = "f16" ) ]
121+ Float16 ( :: half:: f16 ) ,
120122 Float32 ( f32 ) ,
121123 Float64 ( f64 ) ,
122124 Boolean ( bool ) ,
@@ -126,6 +128,8 @@ unsafe impl DynClone for DynScalar {
126128 fn dyn_clone ( & mut self , out : & mut [ u8 ] ) {
127129 match self {
128130 Self :: Integer ( x) => x. dyn_clone ( out) ,
131+ #[ cfg( feature = "f16" ) ]
132+ Self :: Float16 ( x) => write_raw ( out, * x) ,
129133 Self :: Float32 ( x) => write_raw ( out, * x) ,
130134 Self :: Float64 ( x) => write_raw ( out, * x) ,
131135 Self :: Boolean ( x) => write_raw ( out, * x) ,
@@ -137,6 +141,8 @@ impl Debug for DynScalar {
137141 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
138142 match self {
139143 Self :: Integer ( x) => Debug :: fmt ( & x, f) ,
144+ #[ cfg( feature = "f16" ) ]
145+ Self :: Float16 ( x) => Debug :: fmt ( & x, f) ,
140146 Self :: Float32 ( x) => Debug :: fmt ( & x, f) ,
141147 Self :: Float64 ( x) => Debug :: fmt ( & x, f) ,
142148 Self :: Boolean ( x) => Debug :: fmt ( & x, f) ,
@@ -637,6 +643,8 @@ impl<'a> DynValue<'a> {
637643
638644 match tp {
639645 Integer ( size) | Unsigned ( size) => DynInteger :: read ( buf, true , * size) . into ( ) ,
646+ #[ cfg( feature = "f16" ) ]
647+ Float ( FloatSize :: U2 ) => DynScalar :: Float16 ( read_raw ( buf) ) . into ( ) ,
640648 Float ( FloatSize :: U4 ) => DynScalar :: Float32 ( read_raw ( buf) ) . into ( ) ,
641649 Float ( FloatSize :: U8 ) => DynScalar :: Float64 ( read_raw ( buf) ) . into ( ) ,
642650 Boolean => DynScalar :: Boolean ( read_raw ( buf) ) . into ( ) ,
0 commit comments