-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I have the following in python:
import struct
a = 0x95006c08
print( a & 0x3FF ) # First: 10 bits --> 8
print( (a >> 10) & 0x1FFF ) # Second: 13 bits --> 27And I am trying to do the equialent with binaryparse:
import binaryparse
import streams
createParser(p):
10: a
13: b
var
a = 0x95006C08
s = newStringStream()
s.write(a)
s.setPosition(0)
var tmp = p.get(s)
echo tmp.a # --> 33 (instead of 8)
echo tmp.b # --> 2688 (instead of 27)What am I doing wrong? I am looking to replicate python's results.
By the way, binaryparse is AWESOME. I love it.
Metadata
Metadata
Assignees
Labels
No labels