coredevice.comm_kernel: improved byte list performance.

This commit is contained in:
pca006132 2021-05-23 13:30:00 +08:00 committed by Sebastien Bourdeauducq
parent 65f0951f1a
commit 93e1bd9ba0
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ def _receive_list(kernel, embedding_map):
tag = chr(kernel._read_int8()) tag = chr(kernel._read_int8())
if tag == "b": if tag == "b":
buffer = kernel._read(length) buffer = kernel._read(length)
return [bool(a) for a in buffer] return list(struct.unpack(kernel.endian + "%s?" % length, buffer))
elif tag == "i": elif tag == "i":
buffer = kernel._read(4 * length) buffer = kernel._read(4 * length)
return list(struct.unpack(kernel.endian + "%sl" % length, buffer)) return list(struct.unpack(kernel.endian + "%sl" % length, buffer))