PMunch / binaryparse

Binary parser for Nim
MIT License
71 stars 6 forks source link

endian processing is wrong #15

Closed codehz closed 3 years ago

codehz commented 3 years ago

basic test: (in x86 arch)

import binaryparse, streams

createParser(simple):
  lu32: size

var t: typeGetter(simple)
t.size = 1
let s = newStringStream("")
simple.put(s, t)
echo repr s.data
s.setPosition 0
echo simple.get(s)

got:

0000000000960060"\0\0\0\1"
(size: 16777216)
PMunch commented 3 years ago

@sealmove, did you only implement signed-ness for the writer?

PMunch commented 3 years ago

Sorry this has taken so long, fixed in: https://github.com/PMunch/binaryparse/commit/7508fa718bc9bd53a87024081de6f1fdec9bb762