DAWG
DAWG copied to clipboard
Incorrect output on Raspberry Pi
Hello,
I am trying to run the BytesDAWG
implementation on Raspberry Pi 4 (AArch64, 64-bit, Python3.7.17) and the values returned by iteritems()
seem to be different from what I get from get()
method. This behavior does not happen when I run it on my laptop (x86_64, 64-bit, Python3.7.17).
Here is the sample code I am running:
import dawg
data = []
keys = [u'foo', u'bar', u'foobar', u'fo']
for item in zip(keys, range(4)):
data.append((item[0], item[1].to_bytes(3, 'little')))
bytes_dawg = dawg.BytesDAWG(data)
results = bytes_dawg.iteritems('fo')
for item in results:
print('key::', item[0], 'value from get::', bytes_dawg.get(item[0], None), ' value from iteritems', item[1])
It's output on Raspberry PI is :
Output 1
key:: fo value from get:: [b'\x03\x00\x00'] value from iteritems b'\xfc\x0c\x00\x03'
key:: foo value from get:: [b'\x00\x00\x00'] value from iteritems b'\xfc\x00\x00\x03'
key:: foobar value from get:: [b'\x02\x00\x00'] value from iteritems b'\xfc\x08\x00\x03'
While on the X86_64 machine, the output is
Output 2
key:: fo value from get:: [b'\x03\x00\x00'] value from iteritems b'\x03\x00\x00'
key:: foo value from get:: [b'\x00\x00\x00'] value from iteritems b'\x00\x00\x00'
key:: foobar value from get:: [b'\x02\x00\x00'] value from iteritems b'\x02\x00\x00'
From output 1, when I convert the byte
representation( returned from iteritems()
) back to int
, it seems to return incorrect values.
Any ideas on why this might be happening?