Skip to main content



      Home
Home » Modeling » EMF » [XCore] bitwise operators in an operation not working
[XCore] bitwise operators in an operation not working [message #1712474] Sun, 25 October 2015 14:35 Go to next message
Eclipse UserFriend
I'm using the latest release

How does one do bitwise operators in an operation? The following does not compile:

op MyObject myOp()
{
var long frequency = 0;
...
frequency += ((value >> 4) & 0xf) * 100;
...
}

The editor issues the following errors:

No viable alternative at input '&'
extraneous input '0xf' expecting ')'

[Updated on: Mon, 26 October 2015 08:18] by Moderator

Re: [XCore] bitwise operators in an operation not working [message #1712638 is a reply to message #1712474] Tue, 27 October 2015 01:34 Go to previous messageGo to next message
Eclipse UserFriend
Bryan,

It looks like | and & are not recognized as keywords/operators by the
grammar. I'm not sure why. IntegerExtensions.bitwiseOr works, but
isn't as pretty.


On 25/10/2015 7:35 PM, Bryan Hunt wrote:
> How does one do bitwise operators in an operation? The following does
> not compile:
>
> op MyObject myOp()
> {
> var long frequency = 0;
> ...
> frequency += ((value >> 4) & 0xf) * 100;
> ...
> }
>
Re: [XCore] bitwise operators in an operation not working [message #1712641 is a reply to message #1712474] Tue, 27 October 2015 02:16 Go to previous message
Eclipse UserFriend
Bryan,

It looks like | and & are not recognized as keywords/operators by the
grammar. I'm not sure why. Please open a bugzilla.
IntegerExtensions.bitwiseOr works, but isn't as pretty.

On 25/10/2015 7:35 PM, Bryan Hunt wrote:
> var long frequency = 0;
> ...
> frequency += ((value >> 4) & 0xf) * 100;
Previous Topic:Display diagnostic
Next Topic:[XCore] @generated NOT being overridden
Goto Forum:
  


Current Time: Fri Nov 07 15:30:38 EST 2025

Powered by FUDForum. Page generated in 0.05168 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top