wtetzner / bitstring

Automatically exported from code.google.com/p/bitstring
GNU General Public License v2.0
0 stars 0 forks source link

Cannot use littleendian for creating bitstrings #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
   Hi !

Altough the specs says, for the BITSTRING constructor:
"The BITSTRING operator takes a list of fields, similar to the list of 
fields for matching", I cannot generate a BITSTRING with little endian 
ints, as follow:

let x =
  BITSTRING { 10 : 2*8 : littleendian }

This gives:
  Unbound value Bitstring.construct_int_le_unsigned

Original issue reported on code.google.com by romain.b...@gmail.com on 5 Aug 2008 at 4:46

GoogleCodeExporter commented 8 years ago
The attached patch may be too naive, but it makes the test code work so far.

The test could also be included in the test suite...

Output with the patch applied:
Test little endian int 0x3039:
0x39 0x30
Test big endian int 0x3039:
0x30 0x39
Test little endian int32 0x499602d2:
0xd2 0x2 0x96 0x49
Test big endian int64 0x499602d2:
0x49 0x96 0x2 0xd2
Test little endian int64 0x1b69b4ba630f34e:
0x4e 0xf3 0x30 0xa6 Ox4b 0x9b 0xb6 0x1
Test big endian int64 0x1b69b4ba630f34e:
0x1 0xb6 0x9b 0x4b Oxa6 0x30 0xf3 0x4e

Tested on a amd64/x86_64 arch.

Original comment by romain.b...@gmail.com on 9 Aug 2008 at 5:01

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in revision 146.  Thanks for your patch.

Original comment by richard....@gmail.com on 20 Aug 2008 at 4:59