You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
everything is fine. E.g. publishing Published NoIssueStruct using foo: some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.1415) Published NoIssueStruct using bar: some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.TWO, bar=3.1415)
leads at receiver side to Content of NoIssueExample some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.1415) Content of NoIssueExample some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.TWO, bar=3.1414999961853027)
If the union is not 8 byte aligned, like in e.g. struct AnotherExampleStruct { float some4ByteVal; ExampleUnion unionData; };
data of the union is not received correctly by a subscriber. Sending side: Published AnotherExampleStruct using foo: some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.1415) Published AnotherExampleStruct using bar: some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.TWO, bar=3.1415)
is received as Content of AnotherExample some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.141498565673828) Content of AnotherExample some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=0.0)
It seems proper 8 byte alignment is done for the union itself (in _calc_union_formats inside ddsutil.py), but aligning properly when the unions are within structs fails.
The text was updated successfully, but these errors were encountered:
Hello,
the issue is related to Python API.
Assuming a union
enum Kind { ONE, TWO };
union ExampleUnion switch(Kind) { case ONE: double foo; case TWO: float bar; };
inside a structure
struct NoIssueStruct { double some8ByteVal; ExampleUnion unionData; };
everything is fine. E.g. publishing
Published NoIssueStruct using foo: some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.1415)
Published NoIssueStruct using bar: some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.TWO, bar=3.1415)
leads at receiver side to
Content of NoIssueExample some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.1415)
Content of NoIssueExample some8ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.TWO, bar=3.1414999961853027)
If the union is not 8 byte aligned, like in e.g.
struct AnotherExampleStruct { float some4ByteVal; ExampleUnion unionData; };
data of the union is not received correctly by a subscriber. Sending side:
Published AnotherExampleStruct using foo: some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.1415)
Published AnotherExampleStruct using bar: some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.TWO, bar=3.1415)
is received as
Content of AnotherExample some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=3.141498565673828)
Content of AnotherExample some4ByteVal: 42.0, unionData: ExampleUnion(discrimitator=Kind.ONE, foo=0.0)
Full example code:
alignmentIssue.zip
It seems proper 8 byte alignment is done for the union itself (in
_calc_union_formats
insideddsutil.py
), but aligning properly when the unions are within structs fails.The text was updated successfully, but these errors were encountered: