Re: Bit fields in python?

2010-09-08 Thread Kwan Lai Cheng
Thanks everyone for all the suggestions! New to python, so reading up on the struct module & Construct library now, hope to get my problem fixed soon. - Original Message - Bitfields are most commonly used for extreme space optimization - i.e. shoving several variables and flags with

Re: Bit fields in python?

2010-09-07 Thread Kwan Lai Cheng
- Original Message - From: Stefan Behnel To: Sent: Tuesday, September 07, 2010 2:55 PM Subject: Re: Bit fields in python? If you can tell us what these structs are being used for in the original C code, we might be able to point you to a suitable way to implement the same thing eff

Bit fields in python?

2010-09-06 Thread Kwan Lai Cheng
Hi, I'm trying to rewrite a c program in python & encountered several problems. I have some data structures in my c program like below: typedef struct { unsigned short size; unsigned short reserved:8; unsigned short var_a1:2; unsigned short var_a2:2; unsigned short var_a3:2;