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

Erroneous conversion from u24 to u32 #38

Closed
rixed opened this issue Feb 4, 2020 · 0 comments · Fixed by #39
Closed

Erroneous conversion from u24 to u32 #38

rixed opened this issue Feb 4, 2020 · 0 comments · Fixed by #39

Comments

@rixed
Copy link
Contributor

rixed commented Feb 4, 2020

Using the latest 0.6.0:

# #require "stdint";;
# open Stdint;;
# let v = Uint24.of_int 15134052;;
val v : Stdint.Uint24.t = 15134052
# let v' = Uint24.to_uint32 v;;
val v' : Stdint.uint32 = <abstr>
# Uint32.to_int v';;
- : int = 30268105
# Uint32.(to_int (shift_right v' 1));;
- : int = 15134052
rixed added a commit to rixed/ocaml-stdint that referenced this issue Feb 4, 2020
before:

  # Uint32.to_int (Uint24.(to_uint32 (of_int 42)));;
  - : int = 85

after:

  # Uint32.to_int (Uint24.(to_uint32 (of_int 42)));;
  - : int = 42

Closes andrenth#38
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 a pull request may close this issue.

1 participant