예제 #1
0
 private static object packBytes(string format, ReadOnlySpan <byte> bytes)
 {
     if (TypecodeOps.TryGetFromBytes(format, bytes, out object?result))
     {
         return(result);
     }
     else
     {
         return(Bytes.Make(bytes.ToArray()));
     }
 }
예제 #2
0
 private static object PackBytes(char typecode, ReadOnlySpan <byte> bytes)
 {
     // TODO: support non-native byteorder
     if (IsSupportedTypecode(typecode) && TypecodeOps.TryGetFromBytes(typecode, bytes, out object?result))
     {
         return(result);
     }
     else
     {
         throw PythonOps.NotImplementedError("memoryview: format {0} not supported", typecode);
     }
 }