+ def primitive_arr_from_hu(self, mapped_ty, fixed_len, arr_name):
+ inner = arr_name
+ if fixed_len is not None:
+ assert mapped_ty.c_ty == "int8_t"
+ inner = "bindings.check_arr_len(" + arr_name + ", " + fixed_len + ")"
+ if mapped_ty.c_ty.endswith("Array"):
+ return ("bindings.encodeUint32Array(" + inner + ")", "")
+ elif mapped_ty.c_ty == "uint8_t" or mapped_ty.c_ty == "int8_t":
+ return ("bindings.encodeUint8Array(" + inner + ")", "")
+ elif mapped_ty.c_ty == "uint32_t":
+ return ("bindings.encodeUint32Array(" + inner + ")", "")
+ elif mapped_ty.c_ty == "int64_t":
+ return ("bindings.encodeUint64Array(" + inner + ")", "")
+ else:
+ print(mapped_ty.c_ty)
+ assert False
+
+ def primitive_arr_to_hu(self, mapped_ty, fixed_len, arr_name, conv_name):
+ assert mapped_ty.c_ty == "uint8_t" or mapped_ty.c_ty == "int8_t"
+ return "const " + conv_name + ": Uint8Array = bindings.decodeUint8Array(" + arr_name + ");"
+