-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integer attributes should support 64 bit signed integers to be compliant with CANdb++ #91
Comments
Hi, the specs say so, actually
we may switch to What about other parsers? Is CANdb++ opening it right ? Thanks |
Hi, thank you for your answer. |
i wouldnt change the value to u32 since spec says signed integer for both HEX and Int and as is understand the prevois screenshot candb++ parses it without error but still displays uint32.max as int32 min so thats what i would try to do. for api 2.0 maybe change HEX to be HEX so save as string? the problem would then be solved completly. |
Ok, will parse both as A |
If parsed as long you should then probably check that they are not above uint32.max? or just do an unsafe cast back to int32? but then you would get sometthing totally wrong sometimes |
But if I do check, then what happens in user example with max value If we want to mimic CANdb++ then we should relax the Note Please also note that CANdb++ is showing that stuff in the UI, but if I save the dbc back to disk, the original values are stored, which means that internally CANdb++ is keeping the original values and that the cast/crop/whatever is only performed in the UI (which is nevertheless bad from a user perspective since you see wrong values). So if in a var value = -25L;
Console.WriteLine(value.ToString("X")); A |
4294967295 is exactly uint32.max. so i would fail if its over that. Main reson for my convern is that if you safe it as long now that is kind of breaking as all functions users wrote using custom attributes probably expect a int and long to int is no implicit cast. But if you allow to read unit32.max and just safe it as normal int youd not get a (breaking) change and the display would be the same as in your screenshot. But your right if you safe it back or anything it would be the wrong value. from what i get the issue is more linked to Hex values being the uintw.32 max value and as Hex itself has not concept of being signed or unsiged we could allow a max of uint32.max for now and safe it as int32. (bit and therefor hex representaion would be the same still and it wouldnt case an error) |
Ok but then we have broken the signed integer rule, this value is well outside 32 bit signed range
They handle them. I tried 42949672950 (note last 0 just to make it big). CANdb++ UI shows
Ok but what about the minimum? 0? A |
In PropertiesDefinitionLineParser, when checking
match.Groups[IsIntegerValueGroup].Value.Equals("INT")
andmatch.Groups[IsIntegerValueGroup].Value.Equals("HEX")
,the strings are parsed as int:
Minimum = int.Parse(match.Groups[MinIntGroup].Value, CultureInfo.InvariantCulture), Maximum = int.Parse(match.Groups[MaxIntGroup].Value, CultureInfo.InvariantCulture),
,but some values in the dbc I am trying to parse are too large to be stored in int32. They need to be parsed into long.
If there is any way to address this, would be much appreciated. Thank you!
The text was updated successfully, but these errors were encountered: