#3594 closed defect (fixed)
Bitwise operators in MetaModelica are broken
Reported by: | Per Östlund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.4 |
Component: | MetaModelica | Version: | |
Keywords: | Cc: |
Description
The bitwise operators in MetaModelica seem to be completely broken, e.g.:
intBitLShift(1, 1)) // 1 << 1 = 2, OMC says 2. ok! intBitLShift(1, 2)) // 1 << 2 = 4, OMC still says 2! intBitLShift(32, 1)) // 32 << 1 = 64, OMC says 2^37!? intBitRShift(1, 1)) // 1 >> 1 = 0, OMC says 0. ok! intBitRShift(2, 1)) // 2 >> 1 = 1, OMC says 0. intBitRShift(64, 5)) // 64 >> 5 = 2, OMC says 0. intBitOr(1, 2)) // 1 | 2 = 3, OMC says 1. intBitAnd(7, 4)) // 7 & 4 = 4, OMC says 7.
The code generation just generates normal C operators for these, so I'm guessing the issue is due to some fun boxing/unboxing stuff. The operators are not actually used in the compiler at the moment, which would explain why noone's noticed before.
Attachments (1)
Change History (5)
by , 9 years ago
comment:1 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in 881d9f6. It was just a typo in the code generator.
comment:2 by , 9 years ago
Milestone: | Future → 1.9.4 |
---|
Sorting these closed tickets away from "Future". Since they were closed after the last 1.9.3 release, it's very likely that they should have been part of the 1.9.4 release.
Note:
See TracTickets
for help on using tickets.
Test script