runtime/typemapping.py
changeset 3887 2df45e4bd500
parent 3886 2adfa4c60bff
--- a/runtime/typemapping.py	Sat Jan 20 11:41:17 2024 +0100
+++ b/runtime/typemapping.py	Mon Jan 22 21:30:23 2024 +0100
@@ -101,3 +101,9 @@
     if buffoffset and buffoffset == buffsize:
         return res
     return None
+
+def ValueToIECBytes(iectype, value):
+    if value is None:
+        return None
+    c_type, _unpack_func, pack_func = TypeTranslator[iectype]
+    return bytes(pack_func(c_type, value))