Ray Schumacher <[EMAIL PROTECTED]> writes: > At 08:00 AM 1/6/2006, Thomas Heller wrote: > >>RayS <[EMAIL PROTECTED]> writes: >> >>> I'm trying to find an efficient way to convert from DSP32C binary files >>> smmmmmmm mmmmmmmm mmmmmmmm eeeeeeee >>> to IEEE float >>> seeeeeee emmmmmmm mmmmmmmm mmmmmmmm >>> >>> I tried struct and bit-shifting from a C manual example, but it >>> failed. Has someone else coded this in Python? I'll post the early >>> attempt when I get into the office later, if not. >>> >>> I re-coded from scratch, converting each 32 bit ATT value to a binary >>> string, slice-rearranging bits, then re-packing to IEEE. A bit >>> slowwwww. At least they're small files. >> >>You could try ctypes bitfield structures, maybe, to access the fields? > > Sounds interesting, but I have not used them; and on > http://starship.python.net/crew/theller/ctypes/tutorial.html > you wrote > "Bugs, ToDo and non-implemented things > Bitfields are not implemented." > Are they available? Documented? > I have __version__ = "0.9.6"
Available - yes (also in 0.9.6 I think). Documented - no. > I also just read > http://publications.gbdirect.co.uk/c_book/chapter6/bitfields.html > which warned "Be careful using them. It can require a surprising > amount of run-time code to manipulate these things and you can end up > using more space than they save. Bit fields do not have addressesÂyou > can't have pointers to them or arrays of them." This is probably true, but meant as a warning to C programmers. Apparently when using predefined structures you have no other choice than to use them. Thomas _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32