New submission from zeero:

I'm implementing a CAN SAEJ1939 stack in Python and convert CAN message ids in 
between integers and structures, tunneling them through a Union object with 4 
bytes like what i would do in C.

I was checking that particular function and the 3 priority bits were at the 
wrong position. Some trials later i concluded the bits are reversed and 
inverted the order in my structure. Now it works fine.

I'm not sure if it's a bug but i would expect ctypes.Structure to
store the fields in the order i provide and not the other way around.
On the other hand the bytes are in the order i provided.

The System I'm running on is 64Bit Ubuntu AMD A1046 but it shows the same 
behaviour an a 64bit Windows 7 Intel I5

----------
components: ctypes
files: test_structure.py
messages: 248536
nosy: zeero
priority: normal
severity: normal
status: open
title: ctypes.Structure bit order is reversed - counts from right
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file40174/test_structure.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24859>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to