Skip to content
Snippets Groups Projects
Commit 68ab5959 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Util] add dtype allowed assertion to array2hexstring

parent 1bd45ca6
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,8 @@ def array2hexstring(array, dtype, pad_to_nbits):
lineval = BitArray(length=0)
bw = dtype.bitwidth()
for val in array:
# ensure that this value is permitted by chosen dtype
assert dtype.allowed(val)
if dtype.is_integer():
if dtype.signed():
lineval.append(BitArray(int=int(val), length=bw))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment