Skip to content
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

[ocaml] fix uint32 parsing #809

Merged
merged 1 commit into from
Aug 26, 2014
Merged

[ocaml] fix uint32 parsing #809

merged 1 commit into from
Aug 26, 2014

Conversation

flixr
Copy link
Member

@flixr flixr commented Aug 25, 2014

Don't use int32 to represent uint32 so we don't get overflows...
When extracting an uint32 from a bytestream, copy it to a C uint32 first,
then convert that to an int64 for usage in OCaml (since it doesn't have unsigned ints)

This addresses #793 at least for unsigned 32bit values.
Only tested on 64bit system so far...

Don't use int32 to represent uint32 so we don't get overflows...
When extracting an uint32 from a bytestream, copy it to a C uint32 first,
then convert that to an int64 for usage in OCaml (since it doesn't have unsigned ints)

This addresses paparazzi#793 at least for unsigned 32bit values.
Only tested on 64bit system so far...
@flixr
Copy link
Member Author

flixr commented Aug 25, 2014

Confirmed to work on 32bit as expected...
However one needs to be careful when using the ivalue function fw_server.ml and rotorcraft_server.ml, as that converts the value to an ocaml signed int with 31bits (2^30-1 as max value)...

@flixr flixr merged commit c95b2a2 into paparazzi:master Aug 26, 2014
@flixr flixr deleted the pprz_uint32 branch August 26, 2014 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant