12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364type_t=|Uint8:[`u8]t|Int8:[`i8]t|Int16:[`i16]t|Int:[`i32]t|Int64:[`i64]t|Half:[`f16]t|Float:[`f32]t|Double:[`f64]t|ComplexHalf:[`c16]t|ComplexFloat:[`c32]t|ComplexDouble:[`c64]t|Bool:[`bool]tletu8=Uint8leti8=Int8leti16=Int16leti32=Intleti64=Int64letf16=Halfletf32=Floatletf64=Doubleletc16=ComplexHalfletc32=ComplexFloatletc64=ComplexDoubleletbool=Booltypepacked=T:_t->packed(* Hardcoded, should match ScalarType.h *)letto_int:typea.at->int=function|Uint8->0|Int8->1|Int16->2|Int->3|Int64->4|Half->5|Float->6|Double->7|ComplexHalf->8|ComplexFloat->9|ComplexDouble->10|Bool->11;;letpacked_to_int(Tt)=to_inttletof_int_exn=function|0->TUint8|1->TInt8|2->TInt16|3->TInt|4->TInt64|5->THalf|6->TFloat|7->TDouble|8->TComplexHalf|9->TComplexFloat|10->TComplexDouble|11->TBool|d->failwith(Printf.sprintf"unexpected kind %d"d);;let(<>)packed1packed2=packed_to_intpacked1<>packed_to_intpacked2