Simple question, I have some customised java that allows to have 32 bit HW variables.
I would like to asign such a variable a constant 32-bit value, however, this command fails
in the following scenario:
HWINTVar a = const.var(toHWint(32), 0xf1234567);
but works in this scenario:
HWINTVar a = const.var(toHWint(32), 0x11234567);
The error message in the first case is that a critical number of bits can be lost in constant values, and the reason for this is that the constants that I am passing to this method are signed. Is there a simple way how I can tell in Java to interpret this constant value as unsigned values? I tried:
HWINTVar a = const.var(toHWint(32), (unsigned int) 0xf1234567);
HWINTVar a = const.var(toHWint(32), (unsigned integer) 0xf1234567);
but this obvioulsy cant work in Java as it does not support unsigned data types. Any idea how this could be done?
Cheers!
The only way to represent that constant correctly is as a
longliteral, i.e.0xf1234567LAssuming you are able, change the definition of
const.varso that it takes alongfor its second parameter, and extract the bottom 32 bits to put them in yourHWINTVar.