File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ pub enum Value {
169169 DOUBLE ( f64 ) ,
170170 UNKNOWN ( ( ) ) ,
171171 IntVec ( Vec < i32 > ) ,
172+ UIntVec ( Vec < u32 > ) ,
172173 FloatVec ( Vec < f32 > ) ,
173174 BoolVec ( Vec < bool > ) ,
174175}
@@ -297,8 +298,8 @@ impl TryFrom<Value> for Vec<u32> {
297298
298299 fn try_from ( value : Value ) -> Result < Self , Self :: Error > {
299300 match value {
300- Value :: IntVec ( v) => Ok ( v) ,
301- _ => Err ( "Value is not an IntVec " ) ,
301+ Value :: UIntVec ( v) => Ok ( v) ,
302+ _ => Err ( "Value is not an UIntVec " ) ,
302303 }
303304 }
304305}
@@ -539,7 +540,17 @@ impl Sample {
539540 }
540541 }
541542 Value :: DOUBLE ( _) => Value :: DOUBLE ( f64:: from_le_bytes ( raw_val. try_into ( ) . unwrap ( ) ) ) ,
542- Value :: BITS ( _) => Value :: BITS ( u32:: from_le_bytes ( raw_val. try_into ( ) . unwrap ( ) ) ) ,
543+ Value :: BITS ( _) => {
544+ if vc == 1 {
545+ Value :: BITS ( u32:: from_le_bytes ( raw_val. try_into ( ) . unwrap ( ) ) )
546+ } else {
547+ let mut values: Vec < u32 > = Vec :: with_capacity ( vc) ;
548+ for i in 0 ..vc - 1 {
549+ values. push ( u32:: from_le_bytes ( raw_val. try_into ( ) . unwrap ( ) ) ) ;
550+ }
551+ Value :: UIntVec ( values)
552+ }
553+ }
543554 Value :: CHAR ( _) => Value :: CHAR ( raw_val[ 0 ] ) ,
544555 Value :: BOOL ( _) => {
545556 if vc == 1 {
You can’t perform that action at this time.
0 commit comments